The Rubik Rubric
Pick a theme
Who scrambles the cube?
Solved!
The math behind the cube
A Rubik's cube looks like a toy, but every twist is a move in a huge mathematical structure called a group. Here's how the app finds its way back to solved.
How many ways can it be scrambled?
That's about 43 quintillion. It comes from counting what the pieces can do:
The 8 corners can be arranged 8! ways and twisted 37 ways (the last corner's twist is forced by the others). The 12 edges can be arranged 12! ways and flipped 211 ways (the last flip is forced too). Finally, corners and edges can't be swapped independently, which halves the total.
God's Number is 20
In 2010, Tomas Rokicki, Herbert Kociemba, Morley Davidson and John Dethridge proved that every one of those positions can be solved in 20 turns or fewer, counting a half turn as one turn. The proof took about 35 CPU-years of computer time donated by Google.
How this app solves it: Kociemba's two-phase algorithm
Searching 43 quintillion positions directly is hopeless, so the app splits the job in two.
- Phase 1 twists and flips the cube into a special family of positions, the subgroup G1, where every corner and edge is oriented correctly and the four middle-layer edges are back in the middle layer. It tracks three numbers: corner twist (37 = 2,187 values), edge flip (211 = 2,048 values), and which slots the middle edges occupy (12 choose 4 = 495 values). That's about 2.2 billion combinations.
- Phase 2 finishes the solve using only the turns that keep the cube inside G1: quarter and half turns of the top and bottom, and half turns of the four sides. It tracks the corner order (8! = 40,320), the top-and-bottom edge order (8! = 40,320), and the middle-edge order (4! = 24). That's about 19.5 billion combinations.
Searching smart: IDA* and pruning tables
When the app loads, it builds lookup tables with about 4 million entries, each recording the fewest turns needed to fix part of the puzzle. During a search, those tables give a guaranteed minimum for how far away the goal still is. The search tries 1 turn, then 2, then 3, and so on (iterative deepening), and instantly abandons any path the tables prove can't finish in time. That's the "warming up the solver" bar you saw at the start.
Why the counter says ±3
The two-phase method finds a solution in a split second, usually 19 to 22 turns from a full scramble, but not always the absolute shortest. The true minimum is typically within a few turns of it. Finding the guaranteed-shortest solution (Richard Korf's method) can take minutes per position, far too slow to recompute after every turn you make.
How the counter grades your turns
After every turn, the app re-solves the cube from where it now stands. A turn that matches a good solution drops the count by one. A turn in the wrong direction usually raises it. The count is a rubric for each move you make, which is where the name comes from.
Reading the notation
Letters name the face being turned: U (up/top), D (down/bottom), L (left), R (right), F (front) and B (back). A plain letter means a clockwise quarter turn as you face that side, a letter with ′ means counter-clockwise, and a 2 means a half turn. Turning a middle row by dragging makes the slice moves M, E and S.
A little history
Ernő Rubik built the first cube in 1974. In 1981, Morwen Thistlethwaite showed any position could be solved in 52 turns using four nested subgroups. Kociemba's 1992 two-phase method trimmed that to two stages, and it's still the workhorse behind most computer cube solvers today.
