Social-header

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

Table of contents

Quick start

There are two ways to run this app:

Status

Documentation Status Maintenance made-with-python pip-version pyqt-version numpy-version made-with-Markdown contributors Logo Flow-charts UI

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.

Run instructions

To run the app, first finish the pre-requisites mentioned, then

  1. 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.

  2. 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,

start-screen

Documentation

Contents:

  1. How to use
  2. Architecture
  3. Solver.py
  4. Node obj Data structure

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. Find solution
  2. Is solvable?
  3. Reset
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.

how-to-use-01 . how-to-use-02 . how-to-use-03 . how-to-use-04 . how-to-use-05 </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

Thank you for visiting our Repo!