Solve the 8-Puzzle with A*

hard
Unit 25 · BFS II0/0 to milestone

The 8-puzzle is a 3 × 3 board with tiles 1–8 and a blank (0). A move slides a tile into the blank. States are tuples of 9 numbers in row-major order, and the goal is (1, 2, 3, 4, 5, 6, 7, 8, 0).

Pro problem

Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.

Start 7-day free trial
solution.py · Python 3.13
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Solve the 8-Puzzle with A* · TechGradify