Set up the cube
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.
Flat map
U R F D L BSearch algorithm
Solution
Head to head
Runs every algorithm on the cube currently shown in the Solver tab and records the search effort for each one.
| Algorithm | Moves | Expanded | Generated | Stored | Time |
|---|
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.
python evaluate.py and
python heuristic_quality.py in backend/, then reload.
| Algorithm | Optimal | Avg nodes | Avg stored | Avg ms | Max 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
- The front end sends 24 sticker colors in the order U R F D L B.
- The backend reads the color scheme from the fixed down back left corner, so any orientation and any six colors work.
- The stickers become a corner permutation plus corner twists, which is checked for impossible cubes (a missing piece or a single twisted corner).
- 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