I'm currently doing a project where I want to randomly generate mazes for a game. After studying performance levels etc for maze generation I've decided to use the Recursive Division method. Whilst the explanation of the algorithm is somewhat understandable I'm struggling to formulate the algorithm in a pseudo format so that I can understand it fully and begin coding it. Can someone help me with a detailed explanation of the process or some pseudo-code? All help is greatly appreciated.

EDIT: From what I understand I will need to decide whether to divide horizontally or vertically. How is this decision made and what is the process of this division with regards to starting point and finishing point?

有帮助吗?

解决方案

  1. Begin with an empty field.
  2. Bisect the field with a wall, either horizontally or vertically. Add a single passage through the wall.
  3. Repeat step #2 with the areas on either side of the wall.
  4. Continue, recursively, until the maze reaches the desired resolution.

Jamis Buck on Maze Generation: Recursive Backtracking

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top