Binary Tree maze algorithm

The Binary Tree algorithm visits every cell and opens a passage either north or west, chosen at random.

How it works

For each cell, flip a coin: carve north or carve west. Cells on the top row can only go west and cells on the left column can only go north, so the top row and left column become two long, open corridors.

It is the simplest maze algorithm there is and needs no memory at all, but it has a strong diagonal bias: every cell has a path that only ever goes up or left toward the top-left corner. Solving from the bottom-right toward the top-left is easy; the opposite direction is a little harder.

What to watch for

Watch the whole grid fill in one sweep, then notice the open top row and left column and the diagonal grain of the passages.

Properties

Texture
Diagonal bias, two open edges
Dead ends
Many
Uniform
No
Speed
Fastest, one pass
Memory
None

Try it

Open the studio to carve your own Binary Tree maze at any size, solve it with up to four algorithms, and save the video. Or print one.

FAQ

Why does a Binary Tree maze have two open sides?

Top-row cells can't carve north and left-column cells can't carve west, so they always carve along the edge.

Why is it called Binary Tree?

Each cell has one way toward the corner, so the passages form a binary tree rooted at the top-left cell.

All maze algorithms

Pro

and undefined are part of Pro

  • All 8 generators and 7 solvers
  • Giant mazes, up to 201×201, any width and height
  • 7 more colour themes, 4 scales, 3 instruments
  • Titles on your videos, custom timing, any start and goal
  • Race and gauntlet videos, with or without the watermark