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:

    That crazed girl improvising her music,
    Her poetry, dancing upon the shore,
    Her soul in division from itself
    Climbing, falling she knew not where,
    Hiding amid the cargo of a steamship
    Her knee-cap broken.
    William Butler Yeats (1865–1939)

    Direct action ... is the logical, consistent method of Anarchism.
    Emma Goldman (1869–1940)