MAZE VIZ
Generators
Random Generator
- Start with the top left cell and add it to the maze. Select a random neighbor of those cells already in the maze and add it to the maze. Repeat until all cells have been added to the maze.
Depth-First
- Start with the top left cell and add it to the maze. From that cell, pick a neighboring cell and add it to the maze. Mark that cell as the current cell and continue picking neighbors and adding it to the maze. If a cell has no neighboring cells not already in the maze, backtrack back to the last cell with available neighbors. Repeat until all cells have been added to the maze.
Matrix
- Create a grid-like maze to showcase different solver strengths/weaknesses.
Solvers
Breadth-First
- Starting with the maze start, find all connected cells and add the to the queue. For each of those cells in the queue, check to see if any of them are the end. If not, add each one of their connected cells to the queue. Repeat until the ending is found or the queue is empty.
Depth-First
- Searches a path as far as it can go. After reaching a wall, it backtracks back to the last fork with paths not visited and continues searching. Repeat until the end is found or all cells have been visited.
A*
- Starting with the maze start, assign all of the connected cells a distance based on how far away from the maze end they are (ignoring walls) and add it to a collection. Select a new cell from that collection with the lowest distance (and has not been visited) and assign a distance to each one of their neighbors. Repeat until the ending is found of the collection is empty.
By Glenn Tigas