jostbr / pymaze

A maze generator, solver and visualizer for Python
MIT License
272 stars 63 forks source link

Added new algorithm and start location feature #38

Open Yehuda-Bergstein opened 7 months ago

Yehuda-Bergstein commented 7 months ago

Changes Made

Why?

  1. Inspired by Jamis Buck's blog post, I wanted to be able to create a maze that has no 'bias' put simply, by using a form of 'random walk' (The most complex maze for the given space)
  2. Added an option to define the starting cell for an algorithm to begin at, because this algorithm requires that it starts at a random cell (cell must be chosen randomly by user)

Aldous-Broder Algorithm

  1. Choose a random cell, it is marked as visited and becomes the 'current cell'
  2. Of the four neighbors, one is chosen randomly and becomes the 'current cell'
  3. If the neighbor cell is 'unvisited', it is marked as 'visited' and the wall between this cell and the previous cell is removed. If it's already 'visited', the wall is not removed between this cell and the previous cell
  4. Repeat steps 2-3 until all cells are marked as 'visited'
Yehuda-Bergstein commented 2 months ago

Hey! can you add it?