An 8 Tile Puzzle solver app.
Explore 8 Tile Puzzle solver app docs »
Report bug
·
Request feature
8 Puzzle solver is a basic app to perform brute force search coupled with breadth first search algorithm to find solution to a given 8 tile puzzle configuration.
Work in progress
- Replace GUI with better UI design and styles.
- Add documentation for Solver and project
- Feat: add feature Save solution
- Feat: add feature load custom user puzzle from a .txt file
- add How to use app instructions
Table of contents
- Quick start
- Pre-Requisites
- Run instructions
- Status
- What’s included
- Documentation
- Bugs and Feature requests
- Creators
- Thanks
Quick start
There are two ways to run this app:
- Download the latest Docker container. and run from the app in that container ( NOte: No Docker container at the moment)
- Clone the repo:
git clone https://github.com/Sudharsan10/TilePuzzelSolver-App.git
Status
What’s included
Within the download you’ll find the following directories and files, logically grouping the modules in its own packages. You’ll see something like this:
TilePuzzleSolver/
├── controller/
| ├── __init__.py
| └── gui_controller.py
├── data/
| ├── __init__.py
| └── ui_data.py
├── docs/ ...
├── img/ ...
├── solver/
| ├── __init__.py
| ├── test_tile_puzzle_solver.py
| └── tile_puzzle_solver.py
├── ui/
| ├── __init__.py
| ├── gui.py
| └── TilePuzzleSolverGUI.ui
├── Readme.md
├── styles.css
└── setup.py
Pre-requisites
This app depends on numpy and PyQt5 libraries. We can setup this up using pip installer or conda virtual environment tool.
- setting up using pip installer
pip install numpypip install PyQt5Note: If you have both python2 and python3 installed replace
pipwithpip3when using python3. In case you need to installpipfollow this link to getpipsetup before running the above commands. - setting up using conda environment for
python3conda install -c anaconda numpyconda install -c anaconda pyqtNote: To install and setup anaconda environment follow this link first and visit this section again after successfully setting up the conda environment.
Run instructions
To run the app, first finish the pre-requisites mentioned, then
- Clone the repo in terminal using following command:
git clone https://github.com/Sudharsan10/TilePuzzelSolver-App.gitor download github repo as
.zipand extract it in the desired location. - In terminal navigate to the root folder abd locate the
setup.pyfile and run the following command:python setup.py
If every requirement is fulfilled a window should open as follow,
Documentation
Contents:
1 How to use
Navigate to the project folder containing setup.py and run it. If using command line to run it, you can follow the command given below,
python setup.py
Enter the initial state of the puzzle and goal state of the puzzle as shown in the fig below.
Now you have three actions to perform in the form of three different button in the options section in the right side of the app. They are,
1.2.1 Is solvable?
If you wish only to check for the solution feasibility for given state then you can use this button just to check the solution feasibility.
1.2.2 Find solution
This button triggers the autoSolve() function, which in checks for the solution feasibility if solution is feasible then it calls the method solve() from the TilePuzzleSolver class, upon completion of solve() method, backtrack() method is called. Which returns the solution to the given puzzle states as a list of numpy array. This can be seen well in the flowchart below.
1.2.3 Reset
This button resets all the fields in the GUI by triggering the ClearAll() method.
If the Find Solution action is performed and upon success, a new button simulation will be visible in the options section and simulation section also becomes visible with four more action buttons and a simulation output area.
Auto/Manual toggle Button: Toggles visibility between start, stop button with manual navigation buttons - next, previous.
Start/Pause buttons: Starts and stops the simulation sates
Next/Previous buttons: use it to manually switch to the next/previous state in solution
Reset button: it reset the simulation output and toggles back to start/pause button.
.
.
.
.
</a>
2 Architecture

3 solver.py

4 Node obj Data Structure

Bugs and feature requests
Have a bug or a feature request? Search for existing and closed issues, if your problem or idea is not addressed yet, please open a new issue.
Creators
@Sudharsan : www.iamsudharsan.com