← anamaya.fyi 2021 · college

Eight tiles and one empty square.

Slide the tiles into order. This solves it with greedy best-first search: expand whichever state looks closest to the goal, where "closest" is just how many tiles are already home. It is fast, it is not optimal, and the gap between those two is the whole point.

Solvable
0
move shown
moves in solution
states expanded
tiles out of place

Half of all shuffles can never be solved

Sliding a tile never changes the parity of the permutation's inversion count, so a board whose parity differs from the goal's is unreachable no matter how long you search. The solver checks that first and refuses immediately — the original 2021 version printed "…Unsolvable…" and stopped, which is the same idea with fewer pixels. Press Make it unsolvable to watch it decline.

Greedy, not optimal

Best-first takes the lowest heuristic every time and never reconsiders the cost of getting there, so it finds a path quickly rather than the shortest one. A* adds the path cost back and returns the optimal solution for more work. Watching the move count come out well above the known optimum is the most useful thing this visualisation does.