CS 484: Special Topics in Graph Theory
MATH 450: Topics in Pure and Applied Mathematics: Graph Theory

Kalamazoo College

Winter 2005

PROGRAMMING PROJECT #2
This is due Thursday of Tenth Week

This document was last modified on February 3, 2005.

Project Outline

The goal of this project is to use a graph to represent a problem and then strategize ways to solve the problem. We will be using the graph class from the first programming project to represent our graphs. You can still display the graph by displaying the adjacency matrix. This project is based on "Shannon's Switching Game", a project from the Applied Graph Theory and Algorithms class at UCSC.*

You may work on this project in groups but I think you will get more out of this project if you work alone.

As with most programming projects, be sure that the work turned in is your own. You are welcome to discuss problems with other groups, but please do NOT look at another group's code or let another group look at your code. You should also acknowledge any assistance you recieve on this project somewhere in your documentation.

Be sure to document your project using the standards of this department. In other words, there should be lots of comments throughout your code describing what you are doing and why. Javadocs would be a great addition to your program.

Your Tasks

  1. We will be using your graph class from the previous programming project. Since a way to input and output a graph already exists there will be only minor modifications needed. You may want to add things specific to the project (such as a way to denote the Gardener or the Woodchuck hole) or make the output easier to use for the game.

  2. You will need to add one (or more) methods to your graph class. The method that is most needed is to determine who won. The woodchuck wins if there is a reinforced path from the Garden to the Woodchuck hole. The Gardener wins if there is no path from the Garden to the Woodchuck hole.

  3. You will also need a class (or the main) to handle the simulation. The simulation should randomly choose who will begin, ask for the edge to be destroyed/reinforced and then ask the graph to modify that edge, The simulation should allow turns to be taken in destroying/reinforcing edges until someone has wowon.

  4. It may be useful to create a method in your graph class that inputs a rather large graph that you can use to test your program along the way. You may have a special input when the user is asked for the number of vertices that triggers this large graph to be used for the game. If you do use this option, document in the comments how to use it so I can use it for grading.

  5. For the next portion of this project you will be implementing at least 3 strategies that the Gardener or Woodchuck can use. You will also need to modify your program so that any number of players can be involved in the game (0 - 2). The easiest strategy to use will be the random strategy. That will count as one of your 3 strategies.
How to turn in your code:
* http://www.soe.ucsc.edu/classes/cmpe177/Fall03/project.pdf