drag to look around · s scramble · urfdlb turn (shift back) · enter solve · ? the moves explained · space next step · p play · 1-4 a way to solve it
El cubo deLeo
Scramble it, or turn its faces yourself. The solver tries every sequence of moves, the short ones first, until one solves it: so the way back it shows you is the shortest there is. Then take it one turn at a time.
Proved, not just tested
A test runs a program on some examples and compares the answers. A proof shows that a claim holds in every case, and a proof checker, a program much smaller than the one it checks, goes through it step by step. So you need not take anyone's word for it: not the author's, and not the AI's that helped write this page. In Bend a claim is a type, a law, and its proof is a program of that type. Bend's checker accepts the program only if the proof is right, and BendTT's kernel, a second and smaller checker, checks it again.
A cube is finite, so many of these proofs work by computation: split the claim into its cases (each face, each turn), compute both sides, and see that they are the same cube. Here is the first law below, as the code states it (names shortened), and its whole proof:
# a quarter turn four times is no turn law quarter_turn_order: for f: Face {cube.pow(turn(f), 4) == cube.solved() : Cube} # its proof: for each face, both sides compute to one cube def quarter_turn_order(f): match f: case U: {==} case R: {==} ... and F, D, L, B the same
What is proved, Bend's checker and BendTT's kernel agreeing (66 laws, in LAWS.bend, their proofs in PROOF.bend):
- The cube is a group, with the laws below: four quarter turns are none, every move can be undone, opposite faces commute and others do not, what every move keeps.
- The search skips only what it may. It never turns the face it just turned and tries opposite faces in one order only, and these laws are why that loses no shortest solution. It may begin with any of the 18 moves (it once could not begin with
D; the law now rules that out). - Reading a cube from its stickers. The solved cube, every move, the superflip and a 23-move scramble read back as themselves; a cube no one could make (one corner twisted, one edge flipped, two pieces swapped, a color on 10 stickers) is refused, at every corner and every edge.
- Moves as text. A link's moves and the notation on screen read back as the same moves.
- Your own cube. The way back the solver finds solves the cube the page shows you, for every move and for three in a row.
- The search's tables. A distance kept modulo 3 still tells a neighbour's exact distance; each of the 4,096 sets of edge places gets its right rank.
- Photos and colors. The six photos come apart as they went in; each "how to hold it" picture shows a corner a real cube has; every color scheme gives the six faces six different colors, and stays so when you change one.
Two more sets are checked by Bend's checker only, as the kernel runs out of fuel on them, a weaker warrant: ALGS.bend (each of the algorithms behind "Solve it your way", 57 OLL, 21 PLL and the shorter sets, reads as written and keeps what its step must keep) and FIT.bend (the camera reads a scrambled cube's colors in each light).
And what is not proved: that the search finds a shortest solution for every cube. It is Korf's IDA*, sound when its tables never overestimate how far a cube is from solved, and that is not proved here, nor is the JavaScript around it. So every answer is checked as it comes: the page plays its moves on the cube, with Cube.bend, the code these laws are about, and shows them only if they solve it.
The group theory under it
The moves of a cube form a group: any two make a third, and each can be undone. The solver's shortcuts rest on these laws about it, written in Bend and proved in Bend: its checker accepts every proof, and so does BendTT's kernel (bend PROOF.bend --verdict).
- Four quarter turns are none.
U⁴ = 1, for every face.proved - Every move can be undone.
R R′ = 1, for every face and every turn.proved - Two turns of one face are one.
Rᵃ Rᵇ = Rᵃ⁺ᵇ, so a shortest solution never turns a face twice in a row, and the search never tries it.proved - Opposite faces commute.
U D = D U, so the search tries the two in one order only.proved - Other faces do not.
R U ≠ U R: the group is not commutative.proved - What a move keeps. Every move twists the corners by 0 in all (mod 3), flips the edges by 0 in all (mod 2), and moves corners and edges with the same parity.proved
- Famous orders.
(R U R′ U′)⁶ = 1and(R U)¹⁰⁵ = 1.proved - One scramble commutes with every move. The superflip, every edge flipped in place:
X R = R Xfor every move, soXcommutes with every cube.proved - Any first move. The search may begin with every one of the 18 moves, and after a face it skips only that face and, for U, R and F, the face across.proved
The solving happens on your device, in Bend compiled to JavaScript, on one Web Worker for each of its cores. First a quick search (Kociemba's two-phase algorithm) finds a short way back, about 20 moves, in a second or two. Then the shortest is looked for, and only lengths below the short way's need searching: once they all have no solution, the short way is a shortest one. Why the first solution found is a shortest one: the search is Korf's (1997) IDA*. Each bound on the length is searched in full, its subtrees shared out among the workers, and a branch is cut only when a table proves it cannot finish in time: one table for the corners (88 million positions) and one each for two sets of six edges (43 million each), fetched once and kept by your browser. Every cube is at most 20 moves from solved. A phone or a laptop proves the shortest for cubes up to about 14 or 15 moves from solved in seconds; a fully random cube (17 or 18) can take longer than the 240 s it gets, as each move more multiplies the search by about 13, and then the page gives the short way, says it may not be the shortest, and how far the search got. Turn on No time limit under the headline and it searches on until it proves the shortest.