This project implements a simple 8-puzzle solver in Go. The program attempts to find the shortest sequence of moves needed to transform an initial 3x3 puzzle state into the target solved state.
The goal is to transform any given puzzle into the following state:
1 2 3
4 5 6
7 8
(The blank space represents the empty tile.)
8 1 3
4 2
7 6 5
- The program initializes the puzzle state.
- It finds the blank space (
" ") position. - It explores all valid moves using BFS, keeping track of the visited states.
- If a solution is found, the sequence of moves (
<,>,v,^) is returned. - If no solution exists, it returns
nil.
To run the solver, simply execute:
go run main.go- Build a UI to play the 8-puzzle game and use solver as AI hints
- Implement random valid state generation