Different algorithms to solve the 8-puzzle.
Explore the docs »
Report Bug
·
Request Feature
The 8-puzzle consists of a 3x3 grid containing 8 tiles numbered from 1 to 8 and one blank space. The objective is to move the tiles around the grid by sliding them into the blank space in order to achieve a specific goal state, typically where the tiles are arranged in numerical order.
The puzzle begins with a random configuration of the tiles, and the player can only move tiles horizontally or vertically into the blank space.
In src
, you can find different solutions solving the puzzle: Greedy and A* algorithm.
Follow these steps to run the project.
git clone https://github.com/janskn/8-puzzle-solver.git
sudo apt-get install python3
pip install numpy
pip install tkinter
The source code was built with Python, mainly using NumPy and Tkinter.
Simply run the files greedy.py
or a_star.py
in src
and click the button to see the solution.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)Distributed under the MIT License. See LICENSE
for more information.