Maze Generator


Size (X by Y):
Pixel size of each square:
Probability of dead-end:
Probability of turn:
Probability of split:
Random seed (-1 to use the current system time):
Iterations of fill_blank_space to run (-1 to run until completely filled):

Begin in the top left corner and end in the bottom right corner.

To watch a maze being constructed, pick a random seed to use and try incrementing fill_blank_space, each time using the same random seed.

Interesting note: if you set the probability of splits to zero, there will be one and only one correct path through the maze. There will still be splits because the maze generator must split off to fill in blank spaces. Furthermore, every black line would be connected to a wall at some point. If solving the maze is too easy, an interesting exercise would be tracking a black line to a wall.

Source code is available (requires CGI CC and GD libraries)