Sidewinder maze algorithm

Sidewinder builds a maze one row at a time: each row is cut into random runs, and every run opens one passage to the row above.

How it works

Work along each row from left to right. At every cell, flip a coin: either carve east and keep the run going, or close the run. When a run closes, pick one random cell in it and carve north from there. The top row can't carve north, so it is one long corridor.

Because every run has exactly one way up, every cell can reach the top row, and the whole maze is connected with no loops. It needs only the current run in memory, so it is very fast.

What to watch for

Watch the rows appear top to bottom, each one breaking into short horizontal runs that each poke one hole upwards.

Properties

Texture
Horizontal runs, one straight top corridor
Dead ends
Many
Uniform
No
Speed
Very fast
Memory
One row

Try it

Open the studio to carve your own Sidewinder maze at any size, solve it with up to four algorithms, and save the video.

FAQ

Why is the top row always open?

Cells in the top row have nowhere north to carve, so every run there keeps going east to the edge.

How is it different from Binary Tree?

Binary Tree lets each cell choose north or west independently. Sidewinder groups cells into runs, which removes Binary Tree's strong diagonal bias.

All maze algorithms

Pro

and undefined are part of Pro

  • All 12 generators and 12 solvers
  • Hexagon, triangle and circle grids; heart, star and 6 more outlines
  • Giant mazes, up to 201×201, any width and height
  • Custom colours, 7 more themes, flood styles, clean no-label videos
  • Any speed from 0.25× to 4×, any amount of loops
  • 4 more scales and 3 more instruments
  • Titles on your videos, custom timing, any start and goal
  • Race and gauntlet videos, with or without the watermark