forked from Concept-Bytes/Open-Chess
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchess_moves.h
More file actions
42 lines (33 loc) · 1.07 KB
/
chess_moves.h
File metadata and controls
42 lines (33 loc) · 1.07 KB
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
#ifndef CHESS_MOVES_H
#define CHESS_MOVES_H
#include "board_driver.h"
#include "chess_engine.h"
// ---------------------------
// Chess Game Mode Class
// ---------------------------
class ChessMoves {
private:
BoardDriver* boardDriver;
ChessEngine* chessEngine;
// Expected initial configuration
static const char INITIAL_BOARD[8][8];
// Internal board state for gameplay
char board[8][8];
// Helper functions
void initializeBoard();
void waitForBoardSetup();
void processMove(int fromRow, int fromCol, int toRow, int toCol, char piece);
void checkForPromotion(int targetRow, int targetCol, char piece);
void handlePromotion(int targetRow, int targetCol, char piece);
public:
ChessMoves(BoardDriver* bd, ChessEngine* ce);
void begin();
void update();
bool isActive();
void reset();
// Get current board state for WiFi display
void getBoardState(char boardState[8][8]);
// Set board state for editing/corrections
void setBoardState(char newBoardState[8][8]);
};
#endif // CHESS_MOVES_H