#include #include #include "fish.h" #include "randGen.h" #include "environ.h" #include "display.h" // fishmatrix.cpp // Program Worksheet apa11.1a #1 // G. Volger // 3.1.01 // Needed new fucntions in environment class // FishCount() - Returns the number of fish in the environment // KillFish(position) - Kills the fish at position in the // environment (if there is one there) void LiveDie(Environment & ocean); // pre: The ocean environment exists // post: For every loop, every existing fish has a 2% of dying. // There are 100 generations of loops int main() { ifstream input; input.open("fishmatrix.dat"); // Make sure fish.dat is in your project directory Environment ocean(input); Display d; d.Show(ocean); Position p1(0,0), p2(-200,200); cout << "\nTrying to kill a fish where there is no fish"; ocean.KillFish(p1); cout << " - OK, it works," << endl; cout << "Trying to kill a fish outside the environment"; ocean.KillFish(p2); cout << " - OK, it works" << endl; LiveDie(ocean); cout << "\nThere are " << ocean.FishCount() << " fish left\n" << endl; d.Show(ocean); return 0; } void LiveDie(Environment & ocean) // pre: The ocean environment exists // post: For every loop, every existing fish has a 2% of dying. // There are 100 generations of loops { }