|
INFT72-232 Advanced Website Development |
Maze Generator and Solver |
|
Topics |
|
Introduction |
|
Mazes provide the foundation of many walk around, pick em up and knock em down games. There are a number of effective maze generation algorithms . These include
This implementation in Flash Mx 2004 uses the depth first search algorithm to generate and faind the path through a perfect maze. A perfect maze is one in which there is a path between any two cells. Also a perfect maze has no cycles. This assignment was chosen to show the potential of Macromedia's Flash and Actionscript as been an implementation language for online games and interactive online computer graphics. One key factor that makes this so, is that the graphic objects or primitives drawn on a surface are persistent ie. they do not have to be drawn for every iteration. More details could be obtained from MazeWork |
|
Maze Generation Algorithm |
|
|
|
Maze Solving Algorithm |
|
|
|
Implementation Using Actionscript in Flash MX. |
|
The implementation in action script, uses a one dimensional array to represent the grid. This requires functions to retrieve and save the two dimension coordinate needed for some computations. Such as determining whether there is a possible adjacent cell in any direction. The while loop needed to iterate through the grid is implemented using the setInterval and ClearInterval functions. Finally a class called Grid_cell was defined in order to maintain the data structure for each cell. This Object has the structure listed below. class Grid_cells {
} The implementation of the program and the class file can be obtained here. Note. This program use a class, in order to recompile the program, the class path of the flash IDE has to be set to the folder in which the file is downloaded. |
|
Program Usage |
|
|