Aging, Breeding, Dying programming assignment

Some ecologists from upstate New York would like to adapt the fish simulation to study the growth over time of populations of fish, given limited resources. They would like to study what happens when fish breed and die over time. They plan to use the simulation model as a means of studying fish populations in lakes in New York State.

The ecologists want to make the following assumptions about the fish:

In addition the ecologists would like to be able to distinguish among fish of different ages in the display:

Download the following files and place them in a folder called LiveBreedDie

Create new LJHS project called Breed and store the project in the LiveBreedDie folder. Move fish.dat into the LiveBreedDie folder. Add all *.cpp files to your project then run the project. If you have warnings with RandGen, remove randGen.cpp from your project. You should get a two-dimensional array display.

Instead of displaying spaces between the fishes in the output, display a dot ('.') for the space. Determine which class needs to be editied and then edit the file so that dots '.''s are output instead of blank spaces.

Assignment

  1. Add an age characteristic to the fish.
  2. Add a probability of dying and a probability of breeding to the fish.
  3. Create a new Environment member function RemoveFish that removes a Fish at a given Position, passed as a parameter, from the Environment.
  4. Create a new Fish member function Act that will be responsible for all of the actions of a fish on each step.
  5. Modify the Fish member function ShowMe so that fish of breeding age or older appear different from younger fish.
  6. Use or modify calls to DebugPrint appropriately, so that they can be used to check the correct functioning of the modified program.
  7. Modify the Simulation member function Step so that it calls Act instead of Move.

Now let's add the good stuff!

  1. Add a sex type to each fish (male, female). When fish are born they are equally likely to be male as they are female. Female fish can only breed if a breeding age male fish is within x units. The probability of breeding is the same as the original problem.
  2. You will have to alter the fish.dat data file, and Environment functions that need the new information about the sex of a fish.
  3. Change your fish display so that juvenile males appear as 'm', breeding males as 'M', and old non-breeding males as '^'. Juvenile females should be displayed as ''f', breeding females as 'F', and older non-breeding females as '&'.
  4. The probabilities of breeding and dying of offspring should be a random value between the probabilities of the parents. Sex type should be a 50/50 random chance.
  5. Determine what distance value from male to female fish produces an equal balance of breeding and dying.

    What to turn in