What’s a good algorithm to generate a maze? [closed]

It turns out there are 11 classic algorithms to generate “perfect” mazes. A maze is perfect if it has one, and only one, solution. Here are some links to each algorithm, in rough order of my preference.

  1. Kruskal’s
  2. Prim’s
  3. Recursive Backtracker
  4. Aldous-Broder
  5. Growing Tree
  6. Hunt-and-Kill
  7. Wilson’s
  8. Eller’s
  9. Recursive Division (Predictable)
  10. Sidewinder (Predictable)
  11. Binary Tree (Flawed)

For more info, check out mazelib on GitHub, a Python library implementing all the standard maze generating/solving algorithms.

Leave a Comment