Public Types | Public Member Functions | Static Public Attributes | Friends
Mobile Class Reference

#include <Mobile.h>

Inheritance diagram for Mobile:
Hunter Monster HunterChecker HunterRandom

List of all members.

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
DiegetDie () const
string getName () const
int getWins () const
char getDecal () const
int getPoints () const
GridgetGrid () const
int getRound () const

Static Public Attributes

static const string directionName []

Friends

class Gridhunt
class Hunter
ostream & operator<< (ostream &, const Mobile &)

Detailed Description

Implements a mobile object (either Hunter or Monster).


Member Enumeration Documentation

enumeration of possible directions.


Constructor & Destructor Documentation

Mobile::Mobile ( const string &  name = "Some Mobile",
char  decal = 'x' 
)

Simple constructor.

Parameters:
nameName of the mobile.
decalDecal used for dispaying the mobile on a grid.

Member Function Documentation

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.


Friends And Related Function Documentation

ostream& operator<< ( ostream &  o,
const Mobile m 
) [friend]

displays mobile name and location


Member Data Documentation

const string Mobile::directionName [static]
Initial value:
 {"X", "N", "NE", "E", "SE",
    "S", "SW", "W", "NW"}

string representaion of directions for printing.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Friends