#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 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 manual::decide void beep() const {g->term.beep();} //called by manual::punish public: wabbit(game *initial_g, unsigned initial_x, unsigned initial_y, char initial_c); virtual ~wabbit(); bool move(); //Functions that use the private data members of class wabbit. friend game::master_t::value_type game::get(unsigned x,unsigned y)const; friend game::master_t::size_type game::count(char c) const; }; #endif