Output Format

The textbox below the maze contains a per-cell encoding of which walls exist. Each cell is represented by a single digit (0–3), and each row is terminated by a | character.

Per-cell encoding

Each digit encodes the state of two walls of the cell as a 2-bit value:

The top and left walls are not encoded per-cell, because they are the bottom/right walls of the neighboring cells (or the outer maze border).

DigitBottom wallRight wallCell looks like
0nono
1yesno
2noyes
3yesyes

Row separators

Each row of the maze is terminated by a | character. Rows are listed top-to-bottom, cells within a row left-to-right.

Worked example

Consider this 4-character string for a 2×2 maze:

21|03|

This decodes as:

PositionDigitWalls
row 0, col 02right wall only
row 0, col 11bottom wall only
row 1, col 00no walls
row 1, col 13bottom and right walls

Rendered (with the implicit outer border drawn in for clarity):

Why this format

Two walls per cell is the minimum needed to fully describe a rectangular maze without redundancy. Encoding only the bottom and right walls means each cell's data is independent of its neighbors’ data, and the outer border (top edge of row 0, left edge of column 0) is implicit.

Note that the output also implies two openings in the outer border: a "start" point at the top-left, which omits the left outer wall of cell (0,0), and a "goal" point at the bottom-right, which omits the right outer wall of cell (X-1, Y-1) for a maze of size X by Y.

← back to maze generator