Harvey Mudd College

Computer Science 60

Spring 1998

Assignments 5 and 6

Assignment 5 due Thurs. 3/5/98, 50 points

Assignment 6 due Thurs. 3/12/98, 50 points

Maze Maker

Assignment 5 will provide an opportunity to create an applet with simple graphics. Assignment 6 extends this to use a queue (similar to one you constructed in assignment 4) to perform breadth-first search of a maze. Maze Maker is a tool for constructing mazes. The user drags the mouse within the rectangular field to create internal walls, as shown in blue above. The object of the maze player is to find a path constructed by the user. Maze Maker is required to display a minimal-length path through the maze, as shown in red above. In Assignment 5, your applet need only allow the user to draw a maze. In assignment 6, path creation is tobe added.

The rules for maze creation (assignment 5) are as follows:

The rules for path creation (assignment 6) are as follows:

You may want to check out Square.java (run the applet) to see how to draw a square and track mouse events. Use the method of an off-screen buffer, as discussed in class and shown in the example, so that your applet does not flicker. This is mandatory. Applets require an html file. The text for this one is Square.html.

For the path-finding, breadth-first search will be explained in the lecture.You may also read about breadth-first search of a graph in the low-level functional programming chapter. The concept is the same, but the graph is implicit in the case of a maze.