UMBC CS 201, Fall 06
UMBC CMSC 201
Fall '06

CSEE | 201 | 201 F'06 | lectures | news | help


CMSC201

Programming Project One
Predator/Prey Simulation

Out: Tuesday 9/26/06

Due: Tuesday 10/3/06,
         Before Midnight

The Objective

The objective of this assignment is to get you started writing programs in C in the UNIX environment. Its main emphasis is design, so we will be designing the project together in class. This project will also give you practice writing functions, loops, switch statements and using separate compilation.

The Background

Populations of predators and their prey that are isolated tend to achieve an equilibrium over time. The pattern tends to be a cyclic increase and decrease in the populations. When the number of predators is low, the number of prey grow. As the prey increase the predators manage to catch more of them. The predators are now healthier and can raise their young with fewer dying out, so the number of predators increases. Now since there are more predators, they will start to reduce the number of prey. When the number of prey decreases too far, the predators won't be able to catch enough of them and the predators will start to die of starvation. That's the cycle.

Those of you who are interested in the predator/prey relationship, might find the following website interesting. It is a National Park Service publication about the moose and wolf populations on Isle Royale .

We will be studying a fictional population of rabbits and/or foxes isolated on an island and will make the following assumptions:

Population Formulas

Formulas and their descriptions courtesy of J. Barry DeRoos of messiah.edu

The Task

You are to write a program that simulates populations of rabbits, foxes or both over time, using the formulas shown above. Certainly there can never be a negative number of rabbits or foxes, so if the calculation of rabbits indicates that there should be a negative number of rabbits, change the number of rabbits to 0. We are also capping the populations at 500 individuals of each type. So if the calculations produce an answer of greater than 500 foxes, the number of foxes should be changed to 500. It is possible to have 500 rabbits and 500 foxes at the same time.

You will have to get input from the user for the following values:

After printing the program explanation and getting the initial values necessary for the simulation, you will display a menu that will allow the user to choose which kind of population to simulate or to change the interaction constant. The choices must be:
  1. Simulate a Population of Rabbits Only
  2. Simulate a Population of Foxes Only
  3. Simulate a Population with Rabbits & Foxes Interacting
  4. Change Interaction Constant
  5. Quit

You will be expected to write twelve functions, other than main(), for this project.

Here are the function prototypes:

You MUST use these function prototypes, as shown, without modification.

Function Descriptions:

Sample Run

Since the output is long, here is a link to a separate webpage containing the sample run.

More Details

Submitting the Program

To submit the file you should use the command:

submit cs201 Proj1 proj1.c util.c util.h

You can check your submission by using the command:

submitls cs201 Proj1


CSEE | 201 | 201 F'06 | lectures | news | help

Tuesday, 26-Sep-2006 08:29:21 EDT