A maze can be generated by starting with a predetermined arrangement of cells with wall sites between them.
Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. The algorithm starts at the root node (selecting some arbitrary node as the root node in the case of a graph) and explores as far as possible along each branch before backtracking.
https://www.youtube.com/watch?v=aCQoM1mUTog
You can install the required Python packages using the following command:
pipenv sync
- screen_width - window width
- screen_height - window height
- nx - number of maze lines
- ny - number of maze columns
Ensure that you can do the following before you run the maze generation:
- screen_width can be divided by nx and get rest 0
- screen_height can be divided by ny and get rest 0
You can generate the maze using the following command:
pipenv run python depthfirst.py