Figure 1: Maze Generation with DFS Shortest Path Finder (Speed up 2x)
- DFS Traversal.
- Random shuffle 4 directions (Up, Down, Left, Right) while traversing to destination.
- Repeat step 1-2 with random start coords in main path and random end coords. This will be our available paths to traverse.
- Once we finished setting our available path, start constructing maze's wall by traversing while making sure wall does not collide with path. Again, the coords are shuffled.
- Run DFS to find the shortest path to traverse after the maze construction.
- Voilà!
- Depth First Search (DFS) Explained
- Flood Fill Animation
- p5.js by TheCodingTrain
- p5.js Official Website