-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPiece.h
executable file
·57 lines (38 loc) · 1.28 KB
/
Piece.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
#ifndef _PIECE_H
#define _PIECE_H
#include "types.h"
using namespace std;
class Piece {
public:
piece_t type;
color_t color;
int squareRow; // 0 - based
int squareCol;
int timesMoved; // used for castling rights
// constructor
Piece(piece_t type, color_t color, int row, int col);
// copy constructor
Piece(const Piece &p);
// destructor
~Piece();
// test if this piece can theoretically reach a square
bool possiblyReachableSquare(int row, int col);
// returns a char containing the FEN notation of the piece
char getNotation();
// returns a char containing the FEN notation of a piece (static version)
static char getNotation(piece_t pieceType);
// converts FEN notation of piece into piece_t
static piece_t getType(char c);
// returns the value of the current piece
int getValue();
// checks if this piece is on home square (probably)
bool isOnHomeSquare();
// the directions that pieces can move towards
static vector<int> di[6];
static vector<int> dj[6];
private:
static bool directionsInitialized;
// initializes members (called in constructors)
void init(piece_t type, color_t color, int row, int col);
};
#endif