-
Notifications
You must be signed in to change notification settings - Fork 7
Player
FrenzyLi edited this page Dec 29, 2016
·
4 revisions
Player is an abstract base class.
enum Player::Action { LOAD, BULLET, PLASMA, METAL, THERMAL };
Five basic actions that can be passed around as function parameters. When converted to integer, LOAD = 0, BULLET = 1, so on and so forth.
enum Player::Result { DRAW, WIN, LOSS };
Three possible results of a duel. When converted to integer, DRAW = 0, WIN = 1, LOSS = 2.
explicit Player(size_t opponent = -1)
Constructs a Player given a unique identifier of your opponent.
virtual Action Player::fight() = 0
This method is a pure virtual function and must be inherited and implemented by its derived class. Invoked when an action is required from player, this method requires a return type of Player::Action.
virtual void perceive(Action action)
Invoked when a turn ends, this method notifies the player of the opponent's action.
virtual void declared(Result result)
Invoked when a duel ends, this method notifies the player of the result of a duel.