https://github.com/av1m/sliding-block-puzzles
Sliding block/tile puzzle solver using multiple algorithms 🧩
https://github.com/av1m/sliding-block-puzzles
algorithms artificial-intelligence sliding-puzzle-game
Last synced: 5 months ago
JSON representation
Sliding block/tile puzzle solver using multiple algorithms 🧩
- Host: GitHub
- URL: https://github.com/av1m/sliding-block-puzzles
- Owner: av1m
- License: mit
- Created: 2021-03-22T00:02:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-17T02:01:58.000Z (over 1 year ago)
- Last Synced: 2025-05-03T14:17:52.127Z (5 months ago)
- Topics: algorithms, artificial-intelligence, sliding-puzzle-game
- Language: Python
- Homepage: https://av1m.github.io/slide_puzzle/#/
- Size: 835 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sliding block puzzles
[](https://github.com/av1m/sliding-block-puzzles/actions/workflows/actions.yaml)
[](https://docs.python.org/3/whatsnew/3.9.html)
[](https://github.com/av1m/sliding-block-puzzles/blob/master/LICENSE)
[](https://av1m.github.io/slide_puzzle/#/)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()](sliding_puzzle/representation/puzzle.py) function
> 💡 An experimental protocol was carried out. The source code as well as an analysis is available in the [report](report/) directory
## Usage 📖
At this stage, you can use the project in different ways:
1. In a python script, consult the [sample](sample/) directory for an example
2. Run the CLI with the command ```python -m sliding_puzzle```_(maybe you need to make `source .venv/bin/activate`)_
Simple command```shell
python3 -m sliding_puzzle --tiles 1 3 2 4 0 7 5 8 6 --method a_star
```More complex
```shell
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
```3. Run the server with the command ```make serve
4. Run a client GUI that request the server (created at 3.) or directly in Python (Flask, Django ...). Try an
example [writing in Flutter](https://github.com/av1m/slide_puzzle)## Get started 🎉
Install the dependencies
```shell
python -m pip install git+https://github.com/av1m/sliding-block-puzzles
```You have now added the dependency, you can:
* Run an example
```shell
wget -qO- https://raw.githubusercontent.com/av1m/sliding-block-puzzles/master/sample/simple.py | python -
```> 💡 All the examples are in the [`sample/`](./sample/) directory
* Run the CLI
```shell
sliding_puzzle
# Or, call it with python
python -m sliding_puzzle
```* Run the server
```shell
cd sliding_puzzle
make serve
```## Developers 👨💻
Use `python3` or `python` command (depending on your configuration)
1. Clone this project
```shell
git clone https://github.com/av1m/sliding-block-puzzles
cd src-puzzles
```2. Run make command
```shell
make install
```3. Test the project
```shell
make test
```Everything has been installed and configured correctly! 🎊
## Deploy the server 🚀
We use a WSGI server.
It can easily be run and deployed using the command :
```bash
gunicorn sliding_puzzle.wsgi --reload --timeout 1000
```For example, if you want to deploy to [Heroku](https://heroku.com), you can create a Heroku project. Then, add the
heroku project to this project (through `git remote add` ) and run this command```shell
make deploy
```> In order to deploy to Heroku, you need a [`Procfile` file](https://devcenter.heroku.com/articles/getting-started-with-python#define-a-procfile)