Getting started
Getting started
Install Kyuubu, scramble and undo a cube, then put a playable view on a page.
Install the package, scramble a cube, undo the scramble and put an interactive view on a page. The state engine works without a browser. Use Node 22 or later for the standalone TypeScript examples.
Install
npm install @johnmorrisdotca/kyuubuThe package has no runtime dependencies and includes its types. React is an optional peer for the separate React entry.
Turn a cube without a page
import { cubeSolved, movesNotation, parseMoves, seededRandom, randomScramble, solvedCube, turnAll, undoAll } from "@johnmorrisdotca/kyuubu";
const scramble = randomScramble(3, 8, seededRandom("daily-cube"));
const start = turnAll(solvedCube(3), 3, scramble);
console.log(movesNotation(scramble, 3));
console.log(cubeSolved(start, 3));
console.log(cubeSolved(turnAll(start, 3, undoAll(scramble)), 3));
console.log(parseMoves("not a move", 3));R U' F U F' R2 S2 D'
false
true
nullThe same seed gives the same random sequence. A state is a string of face letters; each move returns a new string. Always check a parser's result before handing it to the engine.
Put it on a page
Continue with Mount a cube. The public reference includes the engine, themes, guide and input helpers. Replay and cuboids have separate entries, so choose the part your application needs.
Next steps
Replay a solve, Use a cuboid, Embed and share and Troubleshooting cover the next jobs.