pymaze
pymaze copied to clipboard
Added new algorithm and start location feature
Changes Made
- Added a new algorithm called the "Aldous-Broder Algorithm" to the file src/algorithm.py
- Added demo script in examples/aldous_broder.py
- Added an option to set the start point of the algorithm
Why?
- 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)
- 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
- Choose a random cell, it is marked as visited and becomes the 'current cell'
- Of the four neighbors, one is chosen randomly and becomes the 'current cell'
- 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
- Repeat steps 2-3 until all cells are marked as 'visited'
- Currently it was tested and works only with 'show_maze' function, and it doesn't work for example with show_generation_animation