Solved Paint mode
True distance 0
h corners0 h PDB0
Drag to orbit · Scroll to zoom · Keys URFDLB, Shift for prime
Clockwise as seen from that face

Set up the cube

moves

Pick a color, then click stickers on the 3D cube or the flat map. Any orientation works: the solver reads the color scheme from the down back left corner.

No moves yet

Flat map

U R F D L B

Search algorithm

2.00
f = g + w·h. Larger w trusts the heuristic more: fewer nodes, but the answer may not be the shortest.
BFS and A* (corner count) can take several seconds on hard cubes.

Solution

Scramble the cube and press Solve.

Head to head

Runs every algorithm on the cube currently shown in the Solver tab and records the search effort for each one.

True distance0
Weighted A* uses the w set in the Solver tab.
AlgorithmMovesExpanded GeneratedStoredTime
Nodes expanded log scale
States held in memory log scale

Offline evaluation

Every solver was run on 204 test cubes: 10 per optimal depth (1 to 11), 50 uniformly random cubes and 45 move scrambles. Answers are checked against God's table, the true distance of all 3,674,160 states.

No saved results yet. Run python evaluate.py and python heuristic_quality.py in backend/, then reload.
Nodes expanded by optimal depth mean of 10 cubes, log scale
Solve time by optimal depth ms, log scale
Weighted A*: effort vs solution quality all 204 cubes
Heuristic accuracy mean h vs true distance, all states
State space by distance from solved log scale
Summary uniform random cubes
AlgorithmOptimalAvg nodesAvg storedAvg msMax ms

The problem

A 2x2 cube has 8 corner pieces and nothing else. If the down back left corner is held still, every position can be reached with only the U, R and F faces, giving 9 moves (U U2 U' R R2 R' F F2 F') and 7! × 36 = 3,674,160 states. Every state can be solved in 11 moves or fewer.

From stickers to a search state

  1. The front end sends 24 sticker colors in the order U R F D L B.
  2. The backend reads the color scheme from the fixed down back left corner, so any orientation and any six colors work.
  3. The stickers become a corner permutation plus corner twists, which is checked for impossible cubes (a missing piece or a single twisted corner).
  4. That is packed into one integer, perm × 729 + twist, and precomputed move tables make each move two list lookups.

The algorithms

Heuristics

Corner count: count the corners that are out of place or twisted. One move touches at most four corners, so ceil(wrong / 4) never overestimates. It is cheap but weak, averaging about 2 when the true distance averages 8.8.

Pattern databases: two small tables made by searching backward from solved. One holds the exact number of moves to fix only the positions (5,040 entries), the other only the twists (729 entries). The heuristic is the larger of the two, which is still a lower bound on the real distance (Korf, 1997).

Tech stack

  • Python 3, NumPy, Flask
  • three.js for the 3D cube
  • Bootstrap 5 and Bootstrap Icons
  • Chart.js for the charts

CSC 425 term project · Josh Spencer · Northern Kentucky University