BlueBubble 1.0
A recommendation algorithm for movies based on a Netlfix database
Loading...
Searching...
No Matches
board.h
Go to the documentation of this file.
1#ifndef BOARD
2#define BOARD
3#include <iostream>
4#include <vector>
5#include "utilities.h"
6#include "coordinates.h"
7#include "../pieces/piece.h"
8#include "../pieces/pawn.h"
9#include "../pieces/bishop.h"
10#include "../pieces/knight.h"
11#include "../pieces/rook.h"
12#include "../pieces/queen.h"
13#include "../pieces/king.h"
14#include <regex>
15#include <string>
16#include "config.h"
17
19class board{
20 private:
22 std::vector<piece*> white_pieces;
23 std::vector<piece*> black_pieces;
27 public:
28 board();
29 board(const board& other);
30 void print();
31 void canonical_print();
32 void put(piece* to_put);
33 void move(coordinates move_from, coordinates move_to);
34 bool is_legal(coordinates move_from, coordinates move_to, bool white_move);
35 void erase_piece(coordinates coord);
36 coordinates get_king_coord(bool white_king);
37 bool is_check(bool white_king);
38 bool is_en_passant_legal(coordinates move_from, coordinates move_to, bool white_move);
39 bool is_king_castling_legal(bool white_move);
40 bool is_queen_castling_legal(bool white_move);
41 void king_castle(bool white_move);
42 void queen_castle(bool white_move);
43 void promote(coordinates to_promote, piece_type new_type);
45 bool is_checkmate_or_pat(bool white_move);
46};
47
49void print_line_separator(bool inverted);
50coordinates get_coord_from_string(std::string move);
51
52#endif
void print_neutral_endl()
print a neutral font color and background color new line
Definition board.cc:129
coordinates get_coord_from_string(std::string move)
Retrieve coordinates from a string.
Definition board.cc:366
void print_line_separator(bool inverted)
print a line separator with board matching background colors
Definition board.cc:136
A class representing the chess board.
Definition board.h:19
bool is_promotion_needed(coordinates coord)
check if a promotion is needed
Definition board.cc:539
std::vector< piece * > black_pieces
Definition board.h:23
void canonical_print()
print the board in canonical form
Definition board.cc:225
bool is_check(bool white_king)
check if the selected player is in check state
Definition board.cc:402
board()
Definition board.cc:4
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
Definition board.cc:421
bool is_checkmate_or_pat(bool white_move)
check if the other player can move without being in a check state
Definition board.cc:546
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.
Definition board.cc:309
void print()
print the board
Definition board.cc:151
piece * board_data[8][8]
Definition board.h:21
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
Definition board.cc:443
void move(coordinates move_from, coordinates move_to)
Move a piece from one position to another, supposing that the move is legal.
Definition board.cc:259
void king_castle(bool white_move)
perform the king-side castling move
Definition board.cc:464
void erase_piece(coordinates coord)
Erase a piece from its corresponding vector according to its coordinates.
Definition board.cc:238
bool is_en_passant_legal(coordinates move_from, coordinates move_to, bool white_move)
Definition board.cc:279
bool last_move_en_passant_eligible
Definition board.h:25
void put(piece *to_put)
put a piece onto the board according to its coordinates
Definition board.cc:123
void promote(coordinates to_promote, piece_type new_type)
Perform a promotion on the specified coordinates. Don't check anything.
Definition board.cc:493
coordinates get_king_coord(bool white_king)
retrieve the king coordinates
Definition board.cc:381
void queen_castle(bool white_move)
perform the queen-side castling move
Definition board.cc:477
int without_attack_or_pawn_counter
Definition board.h:26
coordinates last_move
Definition board.h:24
std::vector< piece * > white_pieces
Definition board.h:22
a class representing coordinates
Definition coordinates.h:5
a generic piece class. white is a boolean indicating the piece's color. legals is a vector indicating...
Definition piece.h:11
piece_type
Represent a piece type. Undefined for default piece.
Definition piece.h:8