This is a personal project that I have worked on. I wanted to learn about maze generator algorithms and how they work. There are many algorithms that can be used to generate mazes, however, I only implemented four different algorithms, based on their implementation difficulty and percentage of dead ends and long corridors.
Originally the maze could be generated to a size of 250x250 cells/units, but I reduced it to 50x50 cells so it can be played as well and shown in once screen at once.
The algorithms used are:
Originally the maze could be generated to a size of 250x250 cells/units, but I reduced it to 50x50 cells so it can be played as well and shown in once screen at once.
The algorithms used are:
1. Prim's - One of the hardest to implement, however it is the fastest and generates mazes that have an even spread of dead ends and corridors. It has no bias towards any patterns and the difficulty of the maze varies from the size dimensions.
2. Recursive Back Tracker (Depth-first search) - Easier than Prim's to implement, but it's esthetically pleasing to watch it generate a maze. Same as the Prim's algorithm, this one has no pattern bias, however, it creates a maze with long corridors and a lower amount of dead ends. The maze difficulty depends on the size dimensions as well.
3. Binary Tree - One of the easiest algorithms to implement, but its drawback is that the generated mazes tend to have a high diagonal bias, meaning that the solutions often are placed around one half of the maze thus easier to solve.
4. Eller's - Roughly the same as the Prim's algorithm when talking about the generated mazes, however it tends to have a solution bias depending on from which corner the algorithm starts building the maze. It is one of the hardest algorithms to implement and it is good for generating infinitely tall mazes since it does not use that much memory.
The algorithms are animated as well so to show how they work step by step. The generated mazes can be played as well once generated.