Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olety/labyrinther
Making and solving mazes with a genetic algorithm in Python!
https://github.com/olety/labyrinther
ai flask genetic-algorithm labyrinth labyrinth-generation maze-generator maze-solver python
Last synced: about 1 month ago
JSON representation
Making and solving mazes with a genetic algorithm in Python!
- Host: GitHub
- URL: https://github.com/olety/labyrinther
- Owner: olety
- License: mit
- Created: 2017-03-21T21:55:34.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T21:36:59.000Z (over 1 year ago)
- Last Synced: 2024-03-18T14:13:07.933Z (9 months ago)
- Topics: ai, flask, genetic-algorithm, labyrinth, labyrinth-generation, maze-generator, maze-solver, python
- Language: Python
- Homepage:
- Size: 1.93 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Labyrinther - solving mazes with GA in Python
## What and why?
This is a project developed for an undergraduate course "Introduction to Artificial Intelligence" in Wrocław University of Science and Technology.
The task given to us was to make a program that would solve mazes using a genetic algorithm, representing the path itself as a sequence of bits (2 bits is enough to encode top/bottom/left/right).
This application serves as a Flask server that gives you access to a console (`http://127.0.0.1:5000/`) allowing you to run different simulations. While you have to provide a maze that the algorithm will solve, there are some example mazes (2x2, 3x3, 5x5 and 10x10) in the project itself, in the directory `example_labyrinths`.
If you want to make your own maze, please look at the format that the mazes have in `example_labyrinths` or edit them to your liking. You can also generate mazes by using the [labyrith module](https://github.com/olety/Labyrinther/blob/master/genetic/genetic/labyrinth.py).
Setting up the simulationOnce simulated, you can view the performance of the resulting algorithm as well as the steps that it took (`http://127.0.0.1:5000/`, ex: `http://127.0.0.1:5000/47`)
Result page (1) - Set up values and winner status
Result page (2) - Progression chartsIn the chart above, orange circle marks the start of the labyrinth, gold square - its end, red triangle means marks a point where one iteration of the algorithm died, and the purple X - the final point of the final iteration of the algorithm.
Result page (3) - Final algorithm steps## How to run
```
pip3 install -r requirements.txt
python3 run.py
```