rubiks-cube-scramble
v1.0.2
Published
Rubiks Cube Scramble Generator
Downloads
10
Maintainers
Readme
rubiks-cube-scramble
A Rubiks Cube Scramble Generator
Installation
npm install rubiks-cube-scramble
yarn add rubiks-cube-scramble
Usage
import scrambleGenerator from "rubiks-cube-scramble";
export const Scrambler = () => {
const [scramble, setScramble] = useState();
const handleScramble = () => {
setScramble(scrambleGenerator());
};
return (
<div>
<strong>{scramble}</strong>
<button onClick={() => handleScramble}>Scramble!</button>
</div>
);
};
Output: "D F2 B2 D2 R' B F' R L U2 F U R' B L B' F2 D F R'"
Options
import scrambleGenerator from "rubiks-cube-scramble";
const scramble;
// generate scramble with 30 turns
scramble = scrambleGenerator({ turns: 30 });
// generate scramble in array type
scramble = scrambleGenerator({ array: true });