Generates a maze & solves it using one of three different algorithms. Written in P5JS.
- The interactive Maze-Generator generates random mazes of various size. You can adjust the difficulty of the maze via a slider.
- You can choose one (or more) algorithms to solve the generated maze.
- You can also set the speed, at which the Solving-Algorithm works
This Maze-Generator uses Depth-First-Search and recursive backtracking to generate a Maze. You can find the entire Algorithm here on Wikipedia.
To create a new maze, move or just click the slider at the bottom, and a new, random Maze will be created.
- The slider lets you customize the cell-size (the size of one individual cell), resulting in simpler or more complex mazes.
- Based on the cell-size, the walls of the labyrinth get drawn thicker or thinner
You can solve the maze by clicking one of the maze-solver buttons.
There are multiple algorithms available:
You can choose between 3 different pathfinding-algorithms to solve the maze:
All these Algorithms have their own Advantages and disadvantages.
- Is not guaranteed to find the fastest path from start to finish
- Is easy to implement
- Is guaranteed to find the fastest path from start to finish
- Can be inefficient
- Is guaranteed to find the fastest path from start to finish
- Can be very efficient
- A* /A-Star is basically an extension of Dijkstra's algorithm. It uses heuristics to guide it's search.
🌬️Breadth First Search🌬️ and ⭐A* / A-Star⭐ are guaranteed to find the optimal path through the maze.
Once the optimal path is found, it will be highlighted (in yellow).
There's a slider that lets you adjust the solving-speed.
You can interactively slow down or speed up the solving-algorithm.
You can solve the same maze using all 3 available pathfing-algorithms.
Each algorithm leaves a differently colored trail.
By the end, you can visually compare the efficiency of the algorithms for a given maze.
The faster an algorithm finds the end of the maze, the better it perfomed.
In other words: The less exploring an algorithm had to do to find the end, the better.