BlueBubble 1.0
A recommendation algorithm for movies based on a Netlfix database
|
A class representing the chess board. More...
#include <board.h>
Public Member Functions | |
board () | |
board (const board &other) | |
the copy constructor, which also copy the pieces pointers | |
void | print () |
print the board | |
void | canonical_print () |
print the board in canonical form | |
void | put (piece *to_put) |
put a piece onto the board according to its coordinates | |
void | move (coordinates move_from, coordinates move_to) |
Move a piece from one position to another, supposing that the move is legal. | |
bool | is_legal (coordinates move_from, coordinates move_to, bool white_move) |
Check if a move is legal, without checking it in regards to king check state. | |
void | erase_piece (coordinates coord) |
Erase a piece from its corresponding vector according to its coordinates. | |
coordinates | get_king_coord (bool white_king) |
retrieve the king coordinates | |
bool | is_check (bool white_king) |
check if the selected player is in check state | |
bool | is_en_passant_legal (coordinates move_from, coordinates move_to, bool white_move) |
bool | is_king_castling_legal (bool white_move) |
check if the king-side castling move is legal, without checking it in regards to king check state | |
bool | is_queen_castling_legal (bool white_move) |
check if the queen-side castling move is legal, without checking it in regards to king check state | |
void | king_castle (bool white_move) |
perform the king-side castling move | |
void | queen_castle (bool white_move) |
perform the queen-side castling move | |
void | promote (coordinates to_promote, piece_type new_type) |
Perform a promotion on the specified coordinates. Don't check anything. | |
bool | is_promotion_needed (coordinates coord) |
check if a promotion is needed | |
bool | is_checkmate_or_pat (bool white_move) |
check if the other player can move without being in a check state | |
Private Attributes | |
piece * | board_data [8][8] |
std::vector< piece * > | white_pieces |
std::vector< piece * > | black_pieces |
coordinates | last_move |
bool | last_move_en_passant_eligible |
int | without_attack_or_pawn_counter |
board::board | ( | ) |
Definition at line 4 of file board.cc.
board::board | ( | const board & | other | ) |
the copy constructor, which also copy the pieces pointers
other |
Definition at line 53 of file board.cc.
void board::canonical_print | ( | ) |
print the board in canonical form
Definition at line 225 of file board.cc.
void board::erase_piece | ( | coordinates | coord | ) |
Erase a piece from its corresponding vector according to its coordinates.
coord | the coordinates of the piece to erase |
Definition at line 238 of file board.cc.
coordinates board::get_king_coord | ( | bool | white_king | ) |
retrieve the king coordinates
white_king | if the selected king is white |
Definition at line 381 of file board.cc.
bool board::is_check | ( | bool | white_king | ) |
check if the selected player is in check state
white_king | indicate if the king checked is white |
Definition at line 402 of file board.cc.
bool board::is_checkmate_or_pat | ( | bool | white_move | ) |
check if the other player can move without being in a check state
white_move | true if the player that just played is White |
Definition at line 546 of file board.cc.
bool board::is_en_passant_legal | ( | coordinates | move_from, |
coordinates | move_to, | ||
bool | white_move ) |
Definition at line 279 of file board.cc.
bool board::is_king_castling_legal | ( | bool | white_move | ) |
check if the king-side castling move is legal, without checking it in regards to king check state
white_move | if the current player is White |
Definition at line 421 of file board.cc.
bool board::is_legal | ( | coordinates | move_from, |
coordinates | move_to, | ||
bool | white_move ) |
Check if a move is legal, without checking it in regards to king check state.
move_from | the initial position |
move_to | the final position |
white_move | indicate if the current active player is White |
Definition at line 309 of file board.cc.
bool board::is_promotion_needed | ( | coordinates | coord | ) |
check if a promotion is needed
coord | the coordinates to check |
bool board::is_queen_castling_legal | ( | bool | white_move | ) |
check if the queen-side castling move is legal, without checking it in regards to king check state
white_move | if the current player is White |
Definition at line 443 of file board.cc.
void board::king_castle | ( | bool | white_move | ) |
void board::move | ( | coordinates | move_from, |
coordinates | move_to ) |
Move a piece from one position to another, supposing that the move is legal.
move_from | the initial coordinates of the piece |
move_to | the final coordinates of the piece |
Definition at line 259 of file board.cc.
void board::print | ( | ) |
print the board
Definition at line 151 of file board.cc.
void board::promote | ( | coordinates | to_promote, |
piece_type | new_type ) |
Perform a promotion on the specified coordinates. Don't check anything.
to_promote | the coordinates of the piece to promote |
new_type | the new type of the piece |
Definition at line 493 of file board.cc.
void board::put | ( | piece * | to_put | ) |
void board::queen_castle | ( | bool | white_move | ) |
|
private |