AI Rules for Building the Maze

After creating a maze by hand on the previous example, here is the breakdown of the rules for creating the maze:

1) Select the current cell (start with the end cell)
2) Randomly select a cell to travel to, exclude cells that have been traveled to before. Choose either left. right or bottom.
3) Continue loop unless there are no connections possible.

Those rules should take care of the creation of the main path, lets try that out first and see if it works.

Also it is very important to define the variables the cells will need in order for this process:

Boolean determining if the cell is part of the final path
number determining the type of cell (there are 9 types: TopRight, Top, TopLeft, Left, middle, right, bottom right, bottom and bottom left). this variable will help speed up the process of looking at neighbor cells.
Cell ID: this ID will help speed up the process of accessing walls.

No comments:

Post a Comment