// PROBLEM 11 - page 878 of the Savitch Textbook #ifndef ORGANISM_H #define ORGANISM_H #include "World.h" // ========================================== // Definition for the Organism base class. // Each organism has a reference back to // the World object so it can move itself // about in the world. // ========================================== class Organism { friend class World; // Allow world to affect organism public: Organism(); Organism(World *world, int x, int y); ~Organism(); virtual void breed() = 0; // Whether or not to breed virtual void move() = 0; // Rules to move the critter virtual int getType() =0; // Return if ant or doodlebug virtual bool starve() = 0; // Determine if organism starves protected: int x,y; // Position in the world bool moved; // Bool to indicate if moved this turn int breedTicks; // Number of ticks since breeding World *world; }; #endif