Maze Generator

Navigation Controls

The navigation controls for rectangular mazes used to be the arrow keys. However, I found that this had a pesky side effect of scrolling the window. Thus, I moved the controls. 'J' is left. 'L' is right. 'I' is up. 'K' is down. (sorry lefties)

The goal is to reach the rightmost cell on the bottom row.

Your randomly generated rectangular maze

Generate another random maze

Cell Size:

Description of the algorithm

The general idea is that each cell in the maze can be reached along exactly one path from the beginning of the maze. Thus, any maze may be described completely by keeping track of the previous cell on that path for each cell in the maze. Then, just start from the beginning and add cells one at a time. As an additional bonus, finding the solution is trivial. It is only a matter of starting at the end and following its path back to the beginning.