This Python project generates a random maze and solves it very quickly and efficiently.
- Install Python libraries
pip install -r requirements.txt
The internal values used for the algorithm can be modified in the labyrinthe_resolution.py
file.
carte = labyrinthe(
largeur=101,
hauteur=101,
ligne_entree="auto",
colonne_entree="auto",
ligne_sortie="auto",
colonne_sortie="auto",
pas=2,
pad_width=1)
argument | type | description |
---|---|---|
largeur | int | Maze width in number of squares |
hauteur | int | Maze height in number of squares |
ligne_entree | int | xentry |
colonne_entree | int | yentry |
ligne_sortie | int | xexit |
colonne_sortie | int | yexit |
pas | int | The step size of the maze generation random walk |
pad_width | str | The size of the outer contour of the labyrinth |
Notes: All values must be modified with full knowledge of the facts. Values are not checked for consistency. For example: the values ligne_entree, colonne_entree, ligne_sortie, colonne_sortie must be smaller than the size of the maze.
Here's an image of a maze, with its solution, generated with this code in less than a second: