Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new algorithm and start location feature #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Yehuda-Bergstein
Copy link

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?

  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'
  • Currently it was tested and works only with 'show_maze' function, and it doesn't work for example with show_generation_animation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant