Python implementation for various maze generation algorithms from the book Mazes for Programmers. I did this a while ago so there's a couple of places where I haven't done things exactly as I would if I was to rewrite everything now. The book is a great resource so pick it up if you want some interesting reading.
In the repo are implementations for four algorithms:
- Recursive Backtracking
- Aldous-Broder
- Hunt and Kill
- Binary Tree
They can be run with python3 <algoname>.py
. To change the parameters such as the maze dimensions just edit the
__main__
section at the end of each file. There are two ways to draw the mazes, matplotlib
(which is the default) and pillow. Both can be installed using pip
. The pillow backend allows coloring of the different cells
based on distance from the origin(Top Left).