#include <Mobile.h>
Public Types | |
enum | Direction { N = 1, NE, E, SE, S, SW, W, NW } |
Public Member Functions | |
Mobile (const string &name="Some Mobile", char decal= 'x') | |
void | say (const string &) const |
bool | pay (int) |
Coord | getPosition () |
bool | teleport () |
bool | move (Direction) |
virtual void | makeMove ()=0 |
Die * | getDie () const |
string | getName () const |
int | getWins () const |
char | getDecal () const |
int | getPoints () const |
Grid * | getGrid () const |
int | getRound () const |
Static Public Attributes | |
static const string | directionName [] |
Friends | |
class | Gridhunt |
class | Hunter |
ostream & | operator<< (ostream &, const Mobile &) |
enum Mobile::Direction |
enumeration of possible directions.
Mobile::Mobile | ( | const string & | name = "Some Mobile" , |
char | decal = 'x' |
||
) |
Simple constructor.
name | Name of the mobile. |
decal | Decal used for dispaying the mobile on a grid. |
Coord Mobile::getPosition | ( | ) |
get your own position. Cost: 1 point.
int Mobile::getRound | ( | ) | const [inline] |
get the round number (rounds start with 1)
virtual void Mobile::makeMove | ( | ) | [pure virtual] |
this member function will be called once per round. It is a pure virtual function and has to be overloaded in your subclass in order to implement the mobile's behavior.
Implemented in Hunter, HunterChecker, HunterRandom, and Monster.
bool Mobile::move | ( | Direction | dir | ) |
move the mobile one square in a given direction. Cost: 1 point.
bool Mobile::pay | ( | int | howMuch | ) |
reduce your available points for this round.
void Mobile::say | ( | const string & | message | ) | const |
say something (don't use cout)
bool Mobile::teleport | ( | ) |
teleport you to a random location on the grid. Cost: 2 points.
ostream& operator<< | ( | ostream & | o, |
const Mobile & | m | ||
) | [friend] |
displays mobile name and location
const string Mobile::directionName [static] |
{"X", "N", "NE", "E", "SE", "S", "SW", "W", "NW"}
string representaion of directions for printing.