-
Notifications
You must be signed in to change notification settings - Fork 0
/
chesso.h
53 lines (31 loc) · 970 Bytes
/
chesso.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
typedef enum {PAWN, KNIGHT, KING} pieceType;
typedef enum {BLACK, WHITE} pieceColor;
typedef struct {
pieceType myPieceType;
pieceColor color;
int position[2]; //row, col. set to -1, -1 if piece has been eaten
bool avaiableForEnpassant;
} piece;
piece* chessboard[8][8];
piece* whitePieces[10];
piece* blackPieces[10];
// more elegant integrate it into the struct?
bool whitePawnHasMoved[8];
bool blackPawnHasMoved[8];
bool enPassantExploited = false;
char row0[18];
char col0[9];
/*Global var, mantains the last move actually tried by the player that moved last*/
int lastMove[4];
bool isPlayerTurn = true; /*when false is AI's turn*/
void initChessboard();
void printChessboard();
bool playerHasWon();
void move(char playerMove[]);
int* decodePlayerMove(char playerMove[]);
bool isCheck(int move[], pieceColor myColor);
bool moveIsLegal(int move[]);
void resetEnPassant();
bool playerHasWon();
void generateRandomMove();
char* encodeMove();