Maze generation: Difference between revisions

Content added Content deleted
(Import the actual algorithm description)
(The start cell is not the exit. In fact, the concept of "exit" is not addressed by this algorithm)
Line 4: Line 4:


<!-- BEGIN TEXT FROM WIKIPEDIA -->
<!-- BEGIN TEXT FROM WIKIPEDIA -->
#Start at a particular cell and call it the "exit."
#Start at a random cell.
#Mark the current cell as visited, and get a list of its neighbors. For each neighbor, starting with a randomly selected neighbor:
#Mark the current cell as visited, and get a list of its neighbors. For each neighbor, starting with a randomly selected neighbor:
#:If that neighbor hasn't been visited, remove the wall between this cell and that neighbor, and then recurse with that neighbor as the current cell.
#:If that neighbor hasn't been visited, remove the wall between this cell and that neighbor, and then recurse with that neighbor as the current cell.