What is the Eight Puzzle Problem?
The Eight Puzzle is a sliding puzzle that consists of a frame of numbered square tiles in random order with one tile missing.
The objective is to place the tiles in order by making sliding moves that use the empty space.
How A* Algorithm Solves It?
A* is an informed search algorithm that finds the shortest path between nodes in a graph. For the Eight Puzzle:
- State Space: All possible arrangements of the tiles
- Goal State: The target arrangement we want to achieve
- Heuristic Function: Manhattan distance - the sum of the distances each tile is from its goal position
- Cost Function: f(n) = g(n) + h(n)
- g(n): The number of moves made so far
- h(n): The estimated number of moves needed (Manhattan distance)
Statistics
Total States: 362,880 (9!)
Solvable States: 181,440 (9!/2)
Maximum Solution Steps: 31 moves
How to Use This Visualizer
- Random Generation: Click "Random" to create a random initial state
- Custom State: Click "Customize" to input your own puzzle state
- Navigation: Use "prev step" and "next step" to view the solution path