CS 110: Introduction to Programming in Java

Kalamazoo College

Final Project:
Obstacle Course


In this program you will implement the Obstacle Course specification from the Object-Oriented Design lab.

Updated Problem Specification:

Design a program to simulate a race through an obstacle course.  Racers start at the starting line and move one space at a time.  The race ends when the first racer crosses the finish line.

Your program should be able to support a variety of racer classes with different movement strategies.

Your program should include a graphical user interface that allows a user to control creating the obstacle course and placing obstacles and racers in it.  Here are several design alternatives for the initialization aspect of the graphical user interface:

Regardless of the program initialization design you choose, your program should be able to handle multiple types of racers (or multiple movement strategies).  You could allow each racer on the course to be of a different type, or you could allow one type for each run of the simulation, with all racers in a given run having the same type.  Your program should also provide start/stop buttons and/or a step button.  Finally, your program should graphically display the state of the obstacle course and obstacles and racers in it at the end of each time unit and provide a slider bar for changing the speed of the racers.  (Actually, the slider bar 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 racers.)  When the first racer crosses the finish line, your program should report which racer finished first, and its winning time.

Getting Started:

You may use the following classes or files, which have been fully or partially implemented and are available in ObstacleCourse.zip.  Alternatively, you may implement your own graphical user interface.

Before you can compile the code provided above, you will need to implement or modify the following classes:

Once you have a program that compiles and runs, you should modify it to stop when the first racer reaches the finish line (and report which racer won) and you should implement additional types of racers.  If you are using the graphical user interface classes provided above and want different types of racers to be represented graphically with different images, you will need to edit ObstacleRaceApp to associate each new type of racer with the appropriate image.