Set of rules for chess. More...
#include <Game/Rules/ChessRules.hpp>
Public Member Functions | |
void | init (ChessBoard &cb) |
bool | check (const ChessBoard &cb, Move< ChessBoard::Coords > &move) const |
bool | isCheck (const ChessBoard &cb, const int color) const |
bool | checkVictory (const ChessBoard &cb, const int color) const |
bool | checkDraw (const History< Move< ChessBoard::Coords > > &history) const |
void | move (const ChessBoard &cb, const Move< ChessBoard::Coords > &move) |
Static Public Attributes | |
static const int | PT_PAWN = 1 |
static const int | PT_ROOK = 2 |
static const int | PT_KNIGHT = 3 |
static const int | PT_BISHOP = 4 |
static const int | PT_QUEEN = 5 |
static const int | PT_KING = 6 |
static const int | PC_WHITE = 0 |
static const int | PC_BLACK = 1 |
static const unsigned int | NB_PLAYERS = 2 |
Set of rules for chess.
These rules determines if a move is valid or not (thanks to check()
). Moreover, the rules can also check if a player if victorious, or if it is a draw, respectively with checkVictory()
and checkDraw()
To complete the needs of game settings, the function init()
will define the set of initial pieces to start the game.
const int ChessRules::PC_BLACK = 1 [static] |
const int ChessRules::PC_WHITE = 0 [static] |
const int ChessRules::PT_BISHOP = 4 [static] |
const int ChessRules::PT_KING = 6 [static] |
const int ChessRules::PT_KNIGHT = 3 [static] |
const int ChessRules::PT_PAWN = 1 [static] |
const int ChessRules::PT_QUEEN = 5 [static] |
const int ChessRules::PT_ROOK = 2 [static] |