Behind the Maze

How can one 11-character code rebuild the exact same maze?

This game doesn't store mazes anywhere. Every maze you play is rebuilt on the spot from a short code — no maze data is ever kept on or sent to a server, and yet you and a friend can see exactly the same maze.

This page tells the secret: seeds, maze codes, and the generation algorithm. There's a little math involved, but it's written to be an easy read.

The seed — where a maze begins

Mazes are built from random numbers, but the randomness here isn't truly random. It's pseudorandom: every number flows from a starting value called the seed, and the same seed always reproduces the exact same sequence.

That's why the seed and the difficulty are all it takes to rebuild the entire maze — every wall, the start, and the goal. Open it on any device in any country and the result matches down to the last bit. To keep floating-point drift from ever creeping in, the generator uses integer math only.

Anatomy of a maze code

A maze code looks like M1-7-03NQK8N5. Strip the hyphens and you have exactly 11 characters: a leading M, one character for the format version, one for the difficulty, seven for the seed, and one final check character.

The characters come from a set called Crockford Base32 — the digits 0 through 9 plus the uppercase alphabet minus I, L, O, and U. Dropping the easily confused letters up front makes codes pleasant to write down or read aloud, and if you do write an O by mistake, it's simply read as a 0. Lowercase, hyphens, and spaces are all fine too.

The last character is a checksum. It's computed from the characters before it by a fixed rule, and it catches every single-character typo and every swap of two adjacent characters. A mistyped code will never quietly open the wrong maze.

How a maze grows

The generation algorithm is Growing Tree. Starting from one cell, it carves passages into neighboring cells, growing outward like a tree. Always extending from the newest cell produces long, winding corridors; extending from a random cell produces lots of branching. The difficulty decides how those two tendencies are blended.

At higher difficulties, some dead ends get a wall knocked through to create loops. That defeats the classic trick of keeping one hand on a wall and following it to the exit.

The start and goal are placed on the maze's border, at the two cells farthest from each other. And if the finished maze's solution path is shorter than the difficulty demands, it's regenerated by a fixed rule — even the retries are deterministic, so the same code always yields the same maze. Every maze is also guaranteed solvable, right at the generation stage.

What difficulty 1 to 20 controls

Difficulty sets both the size and the personality of a maze. Level 1 is a cozy 8×8 grid, level 10 is 40×40, and level 20 is a sprawling 60×60. And it's not just size — corridor windiness, branching frequency, the share of loops, and the minimum solution length all climb with it.

Sharing with zero traffic

When you share a maze, the only thing that travels is the 11-character code. Share URLs and printed QR codes carry just an address with that code in it — never maze data. The receiving browser rebuilds the maze on the spot, so even the largest 60×60 maze fits in 11 characters.