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:

    Between married persons, the cement of friendship is by the laws supposed so strong as to abolish all division of possessions: and has often, in reality, the force ascribed to it.

    David Hume (1711–1776)

    It is to be lamented that the principle of national has had very little nourishment in our country, and, instead, has given place to sectional or state partialities. What more promising method for remedying this defect than by uniting American women of every state and every section in a common effort for our whole country.
    Catherine E. Beecher (1800–1878)