Computer Science 210 Lab 8
Due: April 10 (part I), April 17, 2:30

Mazes. The website Logic Mazes contains a number of fun and thoughtful puzzles. For this lab we are interested in the Theseus and the Minotaur puzzles. Your goal in this lab will be to write code capable of of displaying the mazes and their appropriate behavior, as well as solving them using Stacks and Queues. Since this is an ambitious assignment, you will have two weeks to finish it and may work with a partner.

I have provided two graphical classes to help you with the interface (you may use them or ignore them). They are MazeDraw.java and Control.java One of your tasks for the lab will be to figure out how to use them to draw the mazes. Both classes assume that they are called from a class called Theseus, so you'll need that to be your main class if you use them. For my implementation (I have included a runnable version) I provide the drawing classes with the maze (in the form of two matrices that specify where the walls are) and the locations of Theseus and the Minotaur. When I move them I call the updateGuys function and then update to animate.

Your major task in this lab is to use depth-first search to figure out how Theseus can make it through the maze safely. The simplest way to do this will be to use a Stack. Essentially at any given point in the maze Theseus has several options on where to move. He can choose one and push it onto a stack of moves. Eventually he'll either make it out of the maze or run into the bull. If he runs into the bull he's made at least one mistake. He can then pop moves off the stack (backtrack) and try different moves than he did previously. Think of it as a sort of undo maneuver. One of the questions is how to represent a move and what to put on the stack.

What to do/hand in. I'll need to see progress in the first week. By then you should have played with the original mazes a little in order to understand them. Please email me the code of a solution for a maze higher than #6 (no collaboration on this part). Also hand in something to prove that you are making good progress. For example the basic code structure of the program, and its data structures. At the end of two weeks you'll need a complete working version. Improvements are welcome (and will be rewarded). For example you could make the program take in user moves as in the original version.