Representation of a slide puzzle and implementation of algorithms allowing the resolution In this repository you will find:
- Command Line Interface (CLI)
- Webservice written in Flask (WSGI Server)
- Representation of a Puzzle (i.e. sliding block puzzle)
- Heuristics
- Linear Conflicts
- Misplaced
- Manhattan
- Algorithms
- A* Search
- Breadth-First Search
- Depth-First Search
- Depth-Limited Search
- Greedy Best-First Search
- Iterative Deepening Depth-First Search
- Uniform-Cost Search
- Bidirectional search
- Iterative Lengthening Search
- Iterative Deepening A* Search
β οΈ Because it's a university project, the cost is not real but can be modified in the Puzzle:get_cost() function
π‘ An experimental protocol was carried out. The source code as well as an analysis is available in the report directory
At this stage, you can use the project in different ways:
-
In a python script, consult the sample directory for an example
-
Run the CLI with the command
python -m sliding_puzzle
(maybe you need to makesource .venv/bin/activate
) Simple commandpython3 -m sliding_puzzle --tiles 1 3 2 4 0 7 5 8 6 --method a_star
More complex
python3 -m sliding_puzzle \ --verbose \ --tiles 4 1 2 3 5 6 7 11 8 9 10 15 12 13 14 0 \ --method a_star depth_limited \ --no-blank-at-first
-
Run the server with the command ```make serve
-
Run a client GUI that request the server (created at 3.) or directly in Python (Flask, Django ...). Try an example writing in Flutter
Install the dependencies
python -m pip install git+https://github.com/av1m/sliding-block-puzzles
You have now added the dependency, you can:
-
Run an example
wget -qO- https://raw.githubusercontent.com/av1m/sliding-block-puzzles/master/sample/simple.py | python -
π‘ All the examples are in the
sample/
directory -
Run the CLI
sliding_puzzle # Or, call it with python python -m sliding_puzzle
-
Run the server
cd sliding_puzzle make serve
Use python3
or python
command (depending on your configuration)
-
Clone this project
git clone https://github.com/av1m/sliding-block-puzzles cd src-puzzles
-
Run make command
make install
-
Test the project
make test
Everything has been installed and configured correctly! π
We use a WSGI server.
It can easily be run and deployed using the command :
gunicorn sliding_puzzle.wsgi --reload --timeout 1000
For example, if you want to deploy to Heroku, you can create a Heroku project. Then, add the
heroku project to this project (through git remote add
) and run this command
make deploy
In order to deploy to Heroku, you need a
Procfile
file