Sidewinder

In a nutshell:

Consider the grid one row at a time. For each row, link random runs of adjacent cells, and then carve north from a random cell in each run. Treat the northern row specially, linking all cells into a single corridor.

images/appendix-sidewinder.png
Typical features:

A strong vertical texture. One corridor runs the length of the northern row. Difficult to use with masks and non-rectangular grids.

Variations:

The texture changes if you choose south instead of north, or if you run the algorithm by columns instead of rows and choose east or west instead of north. Also, the algorithm is easily adapted to 3D (and higher) grids by choosing between north, and (for ...

Get Mazes for Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.