Mouse in a Maze Program

Alyce Brady
Kalamazoo College

In this program you will implement a simulation of a mouse looking for a piece of cheese in a maze.

Problem Specification:

Design a program to simulate mice moving through a maze until they find cheese.  A mouse always starts at the starting position, and moves one unit at a time.  Your program should be able to support mice with different movement strategies.

Your program should read in a maze configuration, including the starting position and the location of the cheese (the start and end locations for the maze).  It should allow the user to run the experiment several times, with different maze configuration files.  Each time, a piece of cheese is put at the end of the maze, a mouse is put at the starting location, and the mouse is allowed to move around the maze looking for the cheese.  The user should be able to choose the type of mouse or mouse movement strategy for each run of the experiment.  Your program should graphically display the state of the mouse and the maze at the end of each time unit.  When a mouse finds the cheese, your program should report how many time units it took for the mouse to find the cheese.

More specific details:

Your program should have a graphical user interface with a File menu, a mouse choice drop-down menu, a button to add a mouse, a panel in which the maze is graphically displayed, and a slider bar for changing the speed of the mouse movement.  (Actually, it controls the speed of the animation -- how long the program pauses to let you view the display between time steps -- rather than the speed of the mice.)

You may use the following classes or files, which have been fully implemented and are available in and grid.jar:

You will need to implement or modify the following classes:

One possible plan of attack:

You will probably find it useful to implement this program in stages (iterative development).  For example, you might:

  1. Implement the minimum amount of code that will let you compile and run a working program. (More details are below.)
  2. Implement a (theoretically) moving mouse. (More details are below.)
  3. Implement various types of moving mice. (More details are below.)
  4. Display the mouse graphically or with an image (this could be done earlier if you like). (More details are below.)

You do not have to develop the program in this way, but if you want to follow this structured approach you will find more details below.

Implementing the minimum amount of code that will let you compile and run a working program:

Implementing a (theoretically) moving mouse:

Implementing various types of moving mice:

Displaying a mouse graphically or with an image: