forked from Wenfei134/chess
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBoard.hpp
45 lines (38 loc) · 1.04 KB
/
Board.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef BOARD_H
#define BOARD_H
#include "Move.hpp"
#include "Pieces/Piece.hpp"
#include "Square.hpp"
#include <memory>
#include <vector>
class Board
{
public:
static const int ROWS = 8;
static const int COLS = 8;
static const int NUM_COLOURS = 2;
static const int NUM_PIECE_TYPES = 6;
private:
std::vector<std::vector<Square>> mBoard;
std::vector<std::shared_ptr<Piece>> mPieces[NUM_COLOURS];
std::vector<Move> mMovesPlayed;
std::shared_ptr<Piece> mKings[NUM_COLOURS];
Move GetLastMove();
void AddPiece(PieceColour colour, PieceType piece, Square *sq);
public:
Board();
~Board();
void Empty();
void DoMove(Move &mv);
void UndoMove();
std::vector<Move> ListLegalMoves(PieceColour colour);
bool IsChecked(PieceColour colour);
bool IsCheckmated(PieceColour colour);
bool IsStalemated(PieceColour colour);
// Returns a pointer to Square in board at row and col corresponding to coord; ex: "d4", "e4"
Square *GetSquare(int row, int col);
bool InRange(int row, int col);
int GetRows();
int GetCols();
};
#endif