class BG::Match Handles one Backgammon match.
Public members:
- Match(uint matchLength, const char* opponentName = 0)
Match to matchLength.
- Match(std::istream& saved)
Load saved match from saved. - enum Side
Backgammon sides are conventionally known as `X' and `O'. - static Side const computerSide = O
Arbitrarily we choose computer to be O and opponent to be X. - class Action
Game atomic action. - const Action* next(void)
Next action to be processed by UI.
Calls made by the UI code when user makes an action Typically those return false
if action is not appropriate (i.e. out of turn). Typically this indicates a bug in the calling code, and I suggest asserting them there, especially during development. - bool opRolls(void)
Called when opponent decides to roll the dice. - bool opDoubles(void)
Called when opponent doubles. - bool partialMoveLegal(MoveDesc const& move) const
Check legality of partial move.
- bool opPlays(MoveDesc const& move)
Opponent moves his checkers. - bool opTakes(void)
Opponent takes the double. - bool opDrops(void)
Opponent drops (rejects the double). - bool opAnswers(bool accept)
Opponent aceepts or rejects a resignation. - void opResigns(uint factor)
Opponent want's to resign.
- void save(std::ostream& to) const
Save match so far to to. - void exportMAT(std::ostream& to) const
Save match to to in JF MAT
format. - struct Status
Current match status. - Status const& status(void) const
Get current status. - Board const& board(void) const
Current match board.