Skip to content

Python implementations for various maze generation algorithms from the book Mazes for Programmers

Notifications You must be signed in to change notification settings

julius383/mazes

Repository files navigation

Maze Algorithms

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.

Running

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).

Example output

Hunt and Kill 100x100

HK

Recursive Backtracking 100x100

RB

Hunt and Kill 100x100

HK

Aldous-Broder 50x50

Aldous

Wilson's 50x50

Wilson

Binary Tree 50x50 South East Bias

Binree

About

Python implementations for various maze generation algorithms from the book Mazes for Programmers

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages