What a maze is, how a computer makes one, and how to find your way through.
A maze is a puzzle made of passages: it branches, it has dead ends, and the challenge is to find the way through.
That is what sets it apart from a labyrinth. A labyrinth has a single path with no choices, and walking it always takes you to the center (see Labyrinth Maker). A maze asks you to decide at every fork, and lets you get lost. The two words are often used for each other, and the labyrinth of the Minotaur in the Greek myth, which nobody could find their way out of, sounds a lot more like a maze.
A maze is made of a few parts:
Start from a grid with every wall standing. Take walls down, one at a time, until every cell can be reached, but never take down a wall between two cells that are already connected, or you would make a loop. When you are done, the passages form what mathematicians call a spanning tree of the grid, and the maze is perfect. What changes from one algorithm to the next is the order in which the walls come down, and each order leaves its mark on the maze:
The Loops setting of Maze Maker then opens some of the dead ends into a neighbor. The maze stops being perfect: there is now more than one way through, and some simple tricks for solving it stop working.
Put one hand on a wall and keep it there.
In a perfect maze, following one wall, always turning the same way, will take you from the entrance to the exit, because all the walls are connected to the outside. It won't take the shortest way, and it fails in a maze with loops when the goal sits on an island of walls that doesn't touch the outside, like the center of a circular maze. In the 19th century, the French engineer Charles Pierre Trémaux described a method that works in any maze: mark each passage as you walk it, and never take a passage marked twice. Computers do it more simply: a breadth-first search explores every cell one step away from the entrance, then two steps, then three, until it reaches the exit, and finds the shortest way. That is how Maze Maker draws its solution, and how it colors the cells by distance.
Maze Maker draws mazes in six shapes. Square mazes are entered at the top left and left at the bottom right. Circular ones, sometimes called theta mazes, are entered from the outside, with the goal at the center; the rings farther out are longer, so a ring splits its cells in two whenever they would get much wider than they are deep. Triangular mazes cut a big triangle into small ones, each with three neighbors at most, which gives them their zigzag look. Star mazes are cut from the same triangle grid: the two big triangles of the six-pointed star line up with the small ones, so its edges stay perfectly straight. Hexagonal mazes are made of hexagonal cells, like a honeycomb, each with up to six neighbors. Heart-shaped mazes are square grids with every cell outside the heart left out. The algorithms don't care about the shape: to them, a maze is just cells and which cells are next to each other. Every maze comes from a number, its seed: the same settings and seed always give the same maze.





