kmay89.com — the desk of worlds

The solving room

← back to the desk

waking the room…

the mathematics

What you are looking at

The program running this page has never been told what a Rubik's cube is. Each puzzle is only a bag of sticker polygons floating in space. To learn what a twist does, the program rotates one slab of stickers — 90° for the cubes, 72° for the megaminx — and asks who landed where. The answer is a permutation, and from that moment on the whole puzzle is pure group theory: scrambling is composing permutations, and solving is finding an inverse.

The pocket cube — God's algorithm

The 2×2 has exactly 3,674,160 reachable positions. That is small enough to visit every single one: when you first press solve, a breadth-first search floods out from the solved state and writes down how far away each position is. After that the cube simply walks downhill — every solution shown is provably optimal, and none ever needs more than 11 turns, because 11 is the pocket cube's God's number.

The 3×3 — Kociemba's two-phase algorithm

The full cube has 43,252,003,274,489,856,000 positions, which is too many to visit. So the solver does what Herbert Kociemba taught the world in 1992: it factors the problem through a subgroup. Phase one uses only the orientations of the pieces and the whereabouts of four middle-slice edges to steer the cube into G1 = ⟨U, D, R², L², F², B²⟩ — a subgroup 2,217,093,120 times smaller than the whole. Phase two finishes the job without ever breaking orientation again. Pruning tables — little precomputed maps of "you are at least this far from home" — keep the search honest, and the answers land around twenty turns. (Twenty is also the 3×3's God's number, proven in 2010 with about 35 CPU-years of computation. This page takes a politer route.)

The big cubes and the megaminx — Ariadne's thread

The 4×4 has about 7.4 × 10⁴⁵ positions, the 5×5 about 2.8 × 10⁷⁴, and the megaminx — the dodecahedron from the photographs that started this room — about 1.0 × 10⁶⁸. Nobody's browser tab holds an optimal solver for those; even their God's numbers are unknown. So these puzzles do what Theseus did: they walk into the labyrinth holding a thread. Every turn of the scramble is remembered, and solving plays the group inverse of that word — simplified where turns cancel — back to the light. It is the one solution guaranteed shorter than the journey in.

How to read the map

Press the map ✦ and the room unrolls a chart of everywhere the puzzle can be. Every dot is real. For the 2×2 the dots are the positions — shells of radius 1, 2, 3… hold the states exactly that many turns from home, straight out of the God table, and you can watch the solve fall inward one shell per turn, never a wasted move. For the 3×3 the nebula is the solver's phase-one coordinate space — all 1,082,565 combinations of orientation and slice, shaded by their proven minimum distance from G1 — with the corner-permutation space of G1 as a bright nucleus at the centre. A solve is a comet: it spirals down the nebula, dives into the nucleus, and lands on the green star at the middle, which is home. The big puzzles chart the only thing that can be charted at their size: the thread itself, winding out with the scramble and back with the solve.

The numbers

Press the numbers ✦ and the room does its statistics in front of you — computed live from the same tables that power the solvers, never quoted from a book. For the 2×2 you get the exact census: how many of the 3,674,160 positions lie at each distance (one at zero, nine at one, and a great swell around nine turns out), the exact mean distance of a random scramble, and — as the cube moves — where this position sits: "deeper than 97% of all positions" is a sentence the room can prove. The 3×3 shows the same census over the phase-one coordinate space, in proven lower bounds. The big puzzles get the only statistic their size allows, and it's a good one: watch the number of possible move-words, which grows by a fixed factor every turn, race past the number of states the puzzle can actually occupy — the pigeonhole principle, live.

Reading the turns

The letters are the cube's old shorthand: U R F D L B are the Up, Right, Front, Down, Left and Back faces, each turned a quarter clockwise as you look at that face. An apostrophe (R', say "R prime") means counter-clockwise; a 2 (R2) means a half turn; on the big cubes 2R means the second layer in from the right. The megaminx names its twelve faces A through L, with + and − for fifths of a turn. Watch the ticker while anything plays and the notation teaches itself.

The scanning booth

On the 3×3, scan your cube ✦ reads a real cube through the camera: six poses, one per face, each pinned down by which centre faces the lens and which centre points up. The centre stickers of your six captures become the six reference colours, every other sticker is matched to its nearest reference, and you can tap any square the light misread. Before teaching, the room checks the laws of the cube — corner twist a multiple of three, edge flips even, permutation parity matched — because a mis-scanned cube is usually an impossible cube, and impossibility is easy to prove. Then Kociemba solves your cube, and the badge walks you through it turn by turn. Camera frames never leave your device.

The camera

The puzzle hangs on a spring. Fling it and it keeps its momentum, bleeding speed exponentially the way a damped oscillator does; push it past the poles and a rubber band pulls it back. Leave it alone long enough and it turns slowly by itself, the way anything well-made asks to be looked at.

Two positions worth meeting

On the 2×2, the antipode ✦ walks you to one of the 2,644 positions that are a proven maximum of 11 turns from home — the far shore of the whole space, chosen at random from the God table and reached by an optimal route. Watch it on the map: the comet flies to the very outermost shell and stops, because there is nowhere farther to go. On the 3×3, the superflip ✦ builds the most famous position in cubing — every edge flipped in place, everything else untouched — the first position ever proven to need all 20 turns, which is how mathematicians learned God's number is at least 20. During any 3×3 solve, look at the ticker: the underline changes colour where phase one hands over to phase two — the exact turn where the cube enters G1 and the algebra changes gears. Click the ticker to copy the whole move word.

For small hands

Teach mode is built for learning with a real cube in your lap: hold it the way you scanned it, and a glowing arrow appears on the face that should turn, sweeping the way your hand should go, before every move. Press again ↺ as many times as you like — the room will happily re-turn the same layer until it feels easy. Nothing is timed, nothing is scored, and the cube never gets impatient.

The design, if you'd like to steal it

View source — it's meant to be read. The whole room is six colour tokens (a warm dark room, three strengths of parchment ink, lamp-amber for attention and home-green for arrival), two typefaces that ship with every computer (Georgia italic for the voice, the system monospace for the facts), and three rules of motion: snaps land with a little overshoot (easeOutBack), flung things keep momentum that bleeds exponentially, and everything past a limit comes back on a spring. Buttons are pills, panels are frosted cards, numbers glow when they matter, and nothing animates that isn't saying something. The tokens are documented at the top of this page's stylesheet, the architecture in the repo's cube/README.md, and the licence is MIT — take it, retune the six colours, and it becomes yours.

The build

No libraries, no frameworks, no model files — raw WebGL and three small JavaScript files. The solver runs in a worker so the room never stutters. The same geometry code that draws the puzzles also discovers their move permutations, and the solvers were verified in a test harness: hundreds of scrambles solved end-to-end before this page was allowed to face you.