The algorithm works like this: using an orthogonal mazes, divide the area either vertically or horizontally at a random position. Then place a door in a random location in the division just created. The division will create two subsections of the original area. Repeat the process on the subsections if they are bigger then a single cell in height or width. If the subsection is wider then taller, divide vertically. If the subsection is taller then wider, divide horizontally, otherwise for a square subsection make a random choice between horizontal or vertical.
Here is an animated gif I created of this algorithm running:
No comments:
Post a Comment