kmay89 / puzzles

The Solving Room

Seven twisty puzzles that scramble and solve themselves in your browser — with the actual mathematics on display, not behind glass. No libraries, no build step, no accounts, nothing tracked.

A glowing megaminx floating in a warm dark room

What this is

A hand-built laboratory for twisty puzzles: a 2×2, 3×3, 4×4 and 5×5 Rubik's cube, a megaminx — the twelve-sided one — a pyraminx and a skewb. Press scramble and any of them ties itself in a knot; press solve and it finds its way home, with real showmanship. But the point isn't the trick. Every instrument in the room exists to let you see the mathematics happen: a map where every dot is a genuine position, a statistics panel that computes its numbers live from the solver's own tables, a camera scanner that reads your physical cube, a teacher that walks you through its solution one glowing arrow at a time, and a door that puts the whole thing on your table in augmented reality.

If you left it alone just now, the room already showed you: it opens with an overture — a scramble and an untying, performed slowly, then fast, then slowly again, the way a magician paces a reveal.

What group theory is, in plain words

Take any object and list all the ways you can change it and still be able to change it back — rotations, reflections, twists. Now notice three things about that list: doing one change after another gives you something still on the list; there's a "do nothing" change; and every change has an undo. A collection with those three properties is called a group, and group theory is the study of what such collections can and cannot do. It sounds austere. It is actually the mathematics of symmetry, and it runs through crystals, particle physics, cryptography, and the wallpaper in your hallway.

A Rubik's cube is a group you can hold. Its elements are the 43,252,003,274,489,856,000 positions; its generators are the six face turns; composing moves is the group operation; the solved cube is the identity; and solving is nothing more or less than finding the inverse of whatever was done to it. Scrambling and solving are the same walk, taken in opposite directions.

The map in the room draws this literally. Lay out every position as a dot, join positions that differ by one turn, and you get the cube's Cayley graph — a universe where "distance from home" means "minimum turns to solve". For the pocket cube the room charts all 3,674,160 positions exactly; watch a solve and you'll see the comet fall inward one shell per turn, never a wasted move, because on that puzzle the room solves optimally and optimality is visible.

How it solves — honestly

Different sizes call for different honesty:

One engine underneath makes this trustworthy: the program never hard-codes what a twist does. It rotates a slab of sticker polygons in space and asks who landed where — the permutation is discovered from geometry, and the solvers derive their move tables through the same discovery, so the picture and the mathematics cannot disagree.

What you get out of it

if you're curious

An hour of "wait, show me that again". Fling the puzzle, open the map beside it, watch a 20-turn solve dive through a subgroup. The mathematics essay inside explains every instrument in plain language.

if you have a real cube

Scan it with your camera (or paint the colours in), and the room solves your cube — then teaches it back one turn at a time, with a glowing arrow on the face to turn and a camera that aims itself. A "back" button forgives everything.

if you're a mathematician

Exact censuses computed live from the God table, proven-distance readouts, a walkable Cayley graph, an antipode button, the superflip, and a sequence lab where any word in the group becomes a performance you can step through forwards and backwards.

if you build things

View source — it's meant to be read. Six colour tokens, two system typefaces, three rules of motion, raw WebGL, and a worker doing the heavy math. Architecture notes in room/README.md. MIT licensed: take it, retune the six colours, make it yours.

The instruments, briefly