Maze generation algorithm in Python – drawing and arrays
There are plenty of maze generation algorithms, some are described here and here. I decided to use one to learn some Python. I chose Recursive Backtracker. You can find longer descriptions in both links, but briefly:
- choose a random cell in the maze
- walk in a random direction
- when there is no possibility to walk farther, go back (backtrack) to find the first cell from which it is possible to proceed
- the algorithm ends when there is no possibility to move from any cell