Mercyhurst UniversityMath DeptDr Williams Home

Sidewinder Maze Generation

The Maze
Options Size:

Max horizontal corridor:


Sidewinder Algorithm

This is an easy to program maze build that produces intricate yet simple mazes. The first row of the maze is always left empty. For later rows:
  1. A random width of a corridor is chosen, with a wall build above and to the right of this corridor. A single gap is map within the northern wall. In this implementation, it is possible to set a maximum width for the size of this corridor; allowing this value to increase will produce less interesting mazes.
  2. Continue adding randomly sized corridors until the row is complete. A gap must be included in each northern wall.
This row construction is repeated until every row is filled. The mazes produced in this way are typically easy to solve when moving from the bottom of the maze to the top, but more challenging to work from the top down.

About the Applet

This applet was created using JavaScript and the P5 library. No other libraries/dependencies are required. If you are having trouble viewing the applet, be sure JavaScript is enabled in your browser. Click here for instructions. Internet Explorer is not recommended for this applet.

This applet was last updated July 2019.