Concept

The concept of generating a maze is to first create a grid and define
exactly how walls, floors and so on are handled. Will the maze have 2
dimensions or 3? Will you have 8 cardinal directions of just 4? Will
you go up and down? How many times maximum will you go up/down? How
far away will you allow to go up/down? Do you want a minimum of so
many rooms in one direction? All these questions must be answered
before you even start creating a maze.

Once you create the parameters, you want to then create a data format
that will similate one room and a grid of rooms to correspond to the
maze you have. Preset the one room to all walls and floors/ceilings
and copy that to the rest of the grid.

Pick a starting point and start walking through the maze creating
random links between the first room and the next as you walk. While
walking and destroying the walls, have the part that destroys the wall
for the room you're going to call up walk yet again (recurse the
procedure walk meaning the procedure calls itself) using the next room
for the parameters for the walk. Keep walking until there are no more
moves available then let it fall through to the end of the procedure
walk. Once you have this done, you'll find out that the maze creates
itself.

The next thing is to pick a way to display the maze and put it up on
the screen, paper, or a disk file.

Implementation

The way I have it accomplished this is to move to the proper screen
location and draw a line on top of the room for the north wall, left
side for west, right side for east, and bottom for south. Currently I
have it set for 5 pixels wide by 5 pixels tall. The program I have
submitted called mazemaker.p shows a simple 2d maze with 4 cardinal
directions and automatically sets itself up the proper size of your
screen. The maximum size of the maze I preset with a constant is 800
by 800 and those numbers are simply pulled out of the air and have no
purpose in the concept of generating the maze. It's not very easy to
leave and offers no easy interface and does it with brute force
causing the fastest maze generating routine possible. I'm not trying
to win awards for the best user interface but I bet this routine
source code will be the core of all future maze generating routines.

One more note on using recursion: Do NOT attempt to create a 800 x 800
maze without using recursion as you will require too large of a second
data variable to store the room data as you walk through the maze.

DL #1 Maze Generator v2.20f

Compatibility
Architecture: 68k PPC