-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboard.h
71 lines (60 loc) · 1.74 KB
/
board.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <vector>
#include <eigen3/Eigen/Dense>
#include <string>
struct Coord{
int row;
int col;
};
struct Move{
Coord from;
Coord to;
bool capture;
bool promotion;
bool special1; // used for castles, en passant
bool special2; // promotion types, etc.
};
class Board{
protected:
Eigen::Array<bool,8,8> whites;
Eigen::Array<bool,8,8> blacks;
Eigen::Array<bool,8,8> pawns;
Eigen::Array<bool,8,8> bishops;
Eigen::Array<bool,8,8> knights;
Eigen::Array<bool,8,8> rooks;
Eigen::Array<bool,8,8> queens;
Eigen::Array<bool,8,8> kings;
Eigen::Array<bool,8,8> threats;
bool player;
int turn;
int game_phase;
bool in_check;
bool debug_mode;
private:
// updates piece positions from old square to new square:
void shift_piece(int fx, int fy, int tx, int ty);
// subroutines of that:
void shift_colour(int fx, int fy, int tx, int ty);
void shift_pawn(int fx, int fy, int tx, int ty);
void shift_bishop(int fx, int fy, int tx, int ty);
void shift_knight(int fx, int fy, int tx, int ty);
void shift_rook(int fx, int fy, int tx, int ty);
void shift_queen(int fx, int fy, int tx, int ty);
void shift_king(int fx, int fy, int tx, int ty);
// move generation:
// std::vector<struct Move> generate_pawn_moves(int player);
void generate_pawn_moves(int player);
// evaluation subroutines:
int evaluate_material();
int evaluate_positions();
int evaluate_pawns();
public:
Board(bool debug = false);
void initialize();
// void move_piece(from, to);
void display();
void user_move();
// std::vector<struct Move> generate_moves(int player);
void generate_moves(int player);
int evaluate();
};