https://github.com/scriptraccoon/maze-creator
visualization of the backtracking algorithm for creating mazes
https://github.com/scriptraccoon/maze-creator
Last synced: over 1 year ago
JSON representation
visualization of the backtracking algorithm for creating mazes
- Host: GitHub
- URL: https://github.com/scriptraccoon/maze-creator
- Owner: ScriptRaccoon
- License: mit
- Created: 2020-05-31T09:21:52.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-26T00:04:25.000Z (over 2 years ago)
- Last Synced: 2024-05-30T16:49:56.217Z (about 2 years ago)
- Language: JavaScript
- Homepage: https://mazecreator.netlify.app/
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Maze creator
A visualization of the well-known backtracking algorithm for the creation of mazes.
Demo: https://mazecreator.netlify.app/
We start with a grid of cells which initially have walls on all of their sides. To create a maze, we start with a random cell and choose randomly one of its non-visited neighbors, removing the wall between them. We put the current cell on a stack and continue with the chosen neighbor in the same way. When at some point no neighbor can be found, we go back along the stack and try to find neighbors there. When every cell is visited, we are done.
For better visualization, the current cell is drawn red, all other visited cells are drawn blue. The walls are white.
Via the menu above the canvas you can adjust the delay for the computation of the next cell as well as the size of the maze.