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.
- 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
- Quick start
- Pre-Requisites
- Run instructions
- Status
- What's included
- Documentation
- Bugs and Feature requests
- Creators
- Thanks
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
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
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 numpy
pip install PyQt5
Note: If you have both python2 and python3 installed replace
pip
withpip3
when using python3. In case you need to installpip
follow this link to getpip
setup before running the above commands. -
setting up using conda environment for
python3
conda install -c anaconda numpy
conda install -c anaconda pyqt
Note: To install and setup anaconda environment follow this link first and visit this section again after successfully setting up the conda environment.
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.git
or download github repo as
.zip
and extract it in the desired location. -
In terminal navigate to the root folder abd locate the
setup.py
file and run the following command:python setup.py
If every requirement is fulfilled a window should open as follow,
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,
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.
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.
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.
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.
@Sudharsan : www.iamsudharsan.com