Project 1

CS 320

75 points, due Feb. 25, 2000

A maze can be looked at as an array of square cells, where m is the number of rows and n is the number of columns in the maze. Each cell has the property that one to three of its sides (or walls) is present. If two walls are present there is a path into the cell and a path leaving the cell. If three walls are present, the cell is a dead end. It is also possible to have a cell with a single wall. (Note: a maze can be represented by a graph in which each node represents a cell and each branch a connections between cells, i.e., the absence of a wall between adjacent cells.)

You are to use OpenGL to construct and display a maze where m and n are command line inputs to the program. The particular type of maze you are to construct is one in which every cell is connected to every other cell and there is exactly one simple path between any pair of cells.

One method to construct such a maze is to start with an array of cells, each of which has all four walls present. We then remove various walls to construct the desired maze. Consider the following algorithm. Initially all cells are said to be unvisited. We start by selecting (visiting) a random cell. We connect this cell to one of its neighbors by randomly visiting one of its unvisited neighbors. We remove the wall between the two cells to connect them. If any of the other three neighbors has not been visited, we put their identifiers on a stack. If we reach a dead end (a cell all of whose neighbors has been visited), we pop an unvisited cell off the stack. When all cells are visited, the stack is empty and we have a maze. (Note that the algorithm requires a stack and a data structure to keep track of which cells have been visited and which have not been visited.) We can then remove two pieces of the outside wall to create an entrance and an exit to the maze. You are also to show a path in another color from between the entrance and exit.

The graphics part of this project is very simple. You can do most of the work before using any graphics at all.

The following will be taken into consideration in evaluating your work:

  1. The design of your solution. E.g., elegance.

  2. The generality of your solution. E.g., allowing the user to specify the size of the window on the command line.

  3. Attention to detail. E.g., detecting pathological conditions and doing the ``right'' thing.

  4. Completeness of testing (of course, you need to provide evidence of testing).

  5. The readability of your code.

  6. The degree of assistance required from me.

(Over)

Submitting Your Project

We will follow this procedure for all projects this semester.

Your solution is to be left in an MS Windows network directory I've set up for you on phoenix. To access your directory, open Network Neighborhood and then locate and open phoenix. You will see your network directory there.

There, you should leave all files necessary for me to build your program from source, as well as any documentation and test files. You should leave an ASCII file, named README.txt, describing the rest of the files in the directory. I will build your program from source and run it for myself.

Your project is due at the beginning of class on the 25th. Phoenix will be configured to deny you access to your network directory after this time. See the syllabus for the late policy.



Thomas P. Kelliher
Thu Feb 10 22:16:15 EST 2000
Tom Kelliher