Maze generation algorithms rendered as CSS Grid examples. Spiral Backtracker includes three distinct seeded variants, and Fractal Tessellation includes two generation modes.
Iterative recursive backtracker. Produces long, winding corridors with few dead ends. O(W×H) time and space.
Randomised Prim's — grows from a seed cell by randomly picking frontier walls. Produces more branchy, uniform mazes. O(W×H) average.
Randomised Kruskal's — shuffles all internal walls and merges disjoint sets. Produces uniformly random spanning trees. O(W×H · α(W×H)) time.
Processes every cell once, carving north or east at random. Produces a strong diagonal bias toward the top-right. O(W×H) time, O(1) extra space.
Loop-erased random walks grow the maze one path at a time. Produces a provably uniform spanning tree — every perfect maze is equally likely. O(W×H·log(W×H)) expected time.
Uniform random walk over the grid — walls are removed only on the first visit to each cell. Produces a uniform spanning tree with no bias. Simple but slow: O(W×H·log(W×H)) expected time.
Builds the maze one row at a time using disjoint sets. Merges adjacent cells of different sets horizontally, then carves at least one downward passage per set. Produces a perfect maze in O(W×H) time with only O(W) space.
Processes each row left to right, collecting cells into a run. Each step either extends the run east or closes it by carving north from a random run member. The top row is always open east. O(W×H) time, O(W) space.
DFS variant with a clockwise turning preference (right, straight, left, back). Creates spiral-heavy local patterns while preserving a perfect maze. O(W×H) time and space.
Alternates between a random walk (kill phase) that carves into unvisited neighbours, and a row-by-row scan (hunt phase) that finds the next unvisited cell adjacent to the maze. Produces mazes with long, winding corridors. O((W×H)²) worst-case time, O(W×H) space.
Starts with a fully open grid and repeatedly bisects chambers with walls, leaving exactly one passage per wall. Produces mazes with long straight corridors and clearly visible rectangular regions. O(W×H) time, O(W+H) stack space.
Grows a spanning tree breadth-first, producing shorter, wider paths and a shallower tree than DFS. Many small dead ends rather than long winding corridors. O(W×H) time and space.
Places rectangular rooms first, then links room centers with connector-specific corridors. This card renders three variants at once: Manhattan-L, Random Walk, and Nearest MST. O(W×H + R²) time, O(W×H + R²) space.
Builds a recursive motif map, then carves a DFS maze guided by local tile preferences. Produces repeating fractal-like directional bands while staying fully connected. O(W×H) time and space.
Recursively subdivides into quadrants, carves local trees, then joins child regions with a spanning connector set. Produces block-structured macro patterns with connected micro-texture. O(W×H) time and space.
Partitions cells into Voronoi regions, then carves intra-region trees and sparse connectors between regions. Includes Border Doors variants: Balanced keeps stronger chamber borders, Braided opens more alternative routes, and Region Border Doors matches the region-border walls plus random punched doors style. O(W×H×S) time, O(W×H) space.
Meta-algorithm that blends DFS and Prim's by choosing the newest cell (50 %) or a random cell (50 %) from an active list. Produces passages that are longer than Prim's but more branched than DFS. O(W×H) time and space.
Combines Aldous-Broder and Wilson's for speed and uniformity. Seeds ~40 % of cells via a fast random walk (Aldous-Broder), then finishes with loop-erased random walks (Wilson's). Produces a uniformly random spanning tree. O(W×H·log(W×H)) expected time.
Tremaux-inspired traversal that tracks edge marks while carving only into unvisited cells. Produces a perfect maze with controlled backtracking behavior. O(W×H) time and space.
Seeds a random alive/dead grid and iterates B5/S45 Moore-neighbourhood rules (4 generations) to grow organic cave-like passages. A Prim-style repair pass ensures full connectivity. O(W×H) time and space.
Uses the classic Maze life-like rule to form thicker, more connected orthogonal labyrinths before the repair pass guarantees full reachability. O(W×H) time and space.
Uses the leaner Mazectric life-like rule to form tighter, wire-like maze structures, then repairs connectivity into a fully traversable result. O(W×H) time and space.