Skip to content
FrenzyLi edited this page Dec 29, 2016 · 4 revisions

Player is an abstract base class.

Types and Constants

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.

Constructor

explicit Player(size_t opponent = -1)

Constructs a Player given a unique identifier of your opponent.

Public Interface

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.

Clone this wiki locally