Maze Generation Algorithm - Recursive Division Method

Recursive Division Method

Illustration of Recursive Division
original chamber division by two walls holes in walls continue subdividing... completed

Mazes can be created with recursive division, an algorithm which works as follows: Begin with the maze's space with no walls. Call this a chamber. Divide the chamber with a randomly positioned wall (or multiple walls) where each wall contains a randomly positioned passage opening within it. Then recursively repeat the process on the subchambers until all chambers are minimum sized. This method results in mazes with long straight walls crossing their space, making it easier to see which areas to avoid.

For example, in a rectangular maze, build at random points two walls that are perpendicular to each other. These two walls divide the large chamber into four smaller chambers separated by four walls. Choose three of the four walls at random, and open a one cell-wide hole at a random point in each of the three. Continue in this manner recursively, until every chamber has a width of one cell in either of the two directions.

Read more about this topic:  Maze Generation Algorithm

Famous quotes containing the words division and/or method:

    Affection, indulgence, and humor alike are powerless against the instinct of children to rebel. It is essential to their minds and their wills as exercise is to their bodies. If they have no reasons, they will invent them, like nations bound on war. It is hard to imagine families limp enough always to be at peace. Wherever there is character there will be conflict. The best that children and parents can hope for is that the wounds of their conflict may not be too deep or too lasting.
    —New York State Division of Youth Newsletter (20th century)

    I know no method to secure the repeal of bad or obnoxious laws so effective as their stringent execution.
    Ulysses S. Grant (1822–1885)