#ifndef WABBITH #define WABBITH #include #include "terminal.h" using namespace std; class wabbit { const terminal *const t; 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 t->key();} //called by wolf::decide void beep() const {t->beep();} //called by wolf::punish public: wabbit(const terminal& init_t, unsigned init_x, unsigned init_y, char init_c); virtual ~wabbit(); bool move(); static list master; static wabbit *get(unsigned x, unsigned y); }; #endif