#ifndef WABBITH #define WABBITH #include "game.h" class wabbit { game *const g; unsigned x, y; const char c; //move calls these functions to decide who eats who. wabbit w1 will eat //wabbit w2 if w1.hungry() > w2.bitter(), i.e., if w1's hunger is //stronger than w2's bitterness. virtual int hungry() const = 0; virtual int bitter() const = 0; //move calls this function to decide which direction to move in. virtual void decide(int *dx, int *dy) const = 0; //move calls this function if this wabbit tries to move off the screen, //or bumps into another wabbit that it can neither eat nor be eaten by. //(Will also be called by manual::decide.) virtual void punish() const {} wabbit(const wabbit& another); //deliberately undefined wabbit& operator=(const wabbit& another); //ditto protected: char key() const {return g->term.key();} //called by wolf::decide void beep() const {g->term.beep();} //called by wolf::punish public: wabbit(game *initial_g, unsigned initial_x, unsigned initial_y, char initial_c); virtual ~wabbit(); bool move(); //A function that uses the x and y private data members of class wabbit. friend wabbit *game::get(unsigned x, unsigned y) const; }; #endif