Mercyhurst UniversityMath DeptDr Williams Home

Binary Tree Maze Generation

The Maze
Options Size:


Binary Tree Algorithm

This is a very easy to implement maze, though it does produce a "bias" in a particular diagonal direction. Moving from left to right across each row, and from top to bottom, a single wall is removed from each cell, either to the east or south. This algorithm can also be adapted to a north/west, north/east, or south/east configuration, beginning at an appropriate corner.

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.