Maze generation algorithm
Maze generation algorithms are automated methods for the creation of mazes.
Maze generation algorithms are automated methods for the creation of mazes. ===Recursive division method=== 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. ==See also== Maze solving algorithm Self-avoiding walk Brute-force search ==References== ==External links== Think Labyrinth: Maze algorithms (details on these and other maze generation algorithms) Jamis Buck: HTML 5 Presentation with Demos of Maze generation Algorithms Maze generation visualization Java implementation of Prim's algorithm Implementations of DFS maze creation algorithm in multiple languages at Rosetta Code Armin Reichert: 34 maze algorithms in Java 8, with demo application Coding Challenge #10.1: Maze Generator with p5.js - Part 1: Maze generation algorithm in JavaScript with p5 Maze Generator by Charles Bond, COMPUTE! Magazine, December 1981
References
No reference rows published for this article.
Cite this article
MLA
"Maze generation algorithm." encyclopegia.org, 2026, https://encyclopegia.org/wiki/maze-generation-algorithm. Accessed 24 November 2026.
Chicago
"Maze generation algorithm." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/maze-generation-algorithm.
APA
encyclopegia.org. (2026). Maze generation algorithm. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/maze-generation-algorithm
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON