Skip to content
UniKit

Rubik's Cube

A 3×3 cube you can actually turn: click a cell or press u/d/l/r/f/b (Shift for counter-clockwise, Alt for half turns) and all 54 stickers rearrange through a real state machine. The scramble is seeded (reproducible from the same seed and length), the hint replays the inverse scramble move by move, and the solved check, timer and turn count all come from the real state.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

3×3 Rubik's Cube

Every face has nine stickers driven by a real state machine: click a cell or press a key and the colours change immediately; the scramble comes from a seed and "solved" is read from the real state.

Right
Front
Left
Back
Scrambled 20 moves (seed mofang) · no turn yet
Turns
0
Faces solved
0/6
Solved
no
Elapsed
0:00.0
Scramble
20
Seed
mofang

Keyboard: u/d/l/r/f/b turn that face clockwise, Shift for counter-clockwise, Alt for a half turn (click the board first for focus).

Turns: 0 · Faces solved: 0/6

Click any cell to turn that face clockwise; the state machine, notation and solved check all live in mofang.ts (pure functions, unit-tested) while the page handles colours, timing and keys.

Scramble notation (reproducible)

Both the scramble and its inverse come from the seed, so you can copy them onto a real cube.

Scramble (20): B D' R2 D2 R D2 R' F2 U2 L' R' F D R2 B' U B U B L'
Inverse formula (run it to solve): L B' U' B' U' B R2 D' F' R L U2 F2 R D2 R' D2 R2 D B'

What this tool does

  • Turn the cube for real: click any cell to turn that face clockwise, or press u/d/l/r/f/b (Shift for counter-clockwise, Alt for a half turn) and all 54 stickers rearrange immediately.
  • Reproduce the same scramble from a seed: the same seed and length always give the same notation, so you can copy it onto a physical cube.
  • Stuck? “Hint” turns the scramble back one move at a time, and “Undo” rolls back a single turn; when it is solved you get the real elapsed time and turn count.

Example

Input

seed mofang · 20-move scramble

Output

Scramble (20): B D' R2 D2 R D2 R' F2 U2 L' R' F D R2 B' U B U B L'

Real output of the “Scramble notation” card below the board (no two consecutive moves share a face). The same seed and length always give this sequence; the inverse line on the same card turns it back to solved.

Frequently asked questions

How do I play?

Click any cell to turn that face clockwise; u/d/l/r/f/b do the same from the keyboard, with Shift for counter-clockwise and Alt for a half turn. The side buttons offer all twelve clockwise and counter-clockwise moves plus “Undo one turn”.

Is the state real?

Yes. All 54 stickers are held by a real cube state machine (ring permutation plus face rotation for U/D/L/R/F/B with prime and half turns), so every turn rearranges the colours by the rules and “solved” is read from that state instead of guessed.

Is the scramble reproducible?

Yes. It is driven by a string seed through `createRng`, so the same seed and length always give the same notation and the same state.

How do timing and hints work, and what is not included?

The first turn starts a real `performance.now()` timer that refreshes every frame and stops when the cube is solved, together with a turn count. “Hint” replays the inverse scramble one move at a time, so twenty clicks return it to solved — it does not pretend to be a solver. There is no Kociemba-style optimal solver and no 3D drag interaction.

Keywords:rubik's cube

Related tools