Environment::RemoveFish(const Position & pos) // pre: there is a fish at pos (IsEmpty(pos) is false) // post: fish removed from pos; IsEmpty(pos) is true { if (IsEmpty(pos)) { cerr << "error - attempt to remove nonexistent fish at:" << pos << endl; return; } Fish undefinedFish; myWorld[pos.Row()][pos.Col()] = undefinedFish; myFishCount--; } void Fish::Breed(environemnt & env) // pre: this fish is stored in env at Location(); // this fish is old enough to breed // post: the neighoring empty positions of thhis fish have been // filled with new fish, each with age 0 and the same // probability of dying as this fish { Neighborhood nbrs = EmptyNeighbors(env, myPos); for (int k = 0; k < nbrs.Size(); k++) env.AddFish(nbrs.Select(k), 0, myProbDie, myProbBreed); } void Fish::Act(Environment & env) // pre: this fish is stored in env at Location() // post: this fish has moved, bred, or died { RandGen r; if(r.RandReal() < myProbDie) { env.RemoveFish(myPos); return; } mmyAge++; if(myAge == 3) { Breed(env); } else Move(env); } int main () { cout << "Ap-A Exam Question #3" << endl; return 0; }