From 1d6a6717ba088c3b89d50021f2bf6656eb564533 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 29 Jul 2026 16:18:52 +0200 Subject: implementing castling --- src/board.hpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/board.hpp') diff --git a/src/board.hpp b/src/board.hpp index 4f04783..2e8cb82 100644 --- a/src/board.hpp +++ b/src/board.hpp @@ -2,7 +2,6 @@ #define SRC_BOARD_H_ #include -#include #include enum PieceType { @@ -26,7 +25,6 @@ enum GameState { struct Piece { bool color = 0; PieceType type = NONEPIECE; - bool moved = false; }; struct Position { @@ -42,7 +40,10 @@ struct TranspositionsEntry { struct Game { Piece pieces[64]; bool turn = 1; // 1 white; 0 black - std::string castle = ""; + bool whiteCastleKing = false; + bool whiteCastleQueen = false; + bool blackCastleKing = false; + bool blackCastleQueen = false; uint8_t halfMoveClock = 0; uint16_t MoveClock = 0; Position enPassant; @@ -75,13 +76,22 @@ struct UndoMove { bool oldTurn; bool oldCanEnpassant; Position oldEnPassant; - std::string oldCaslte; + + bool OldwhiteCastleKing; + bool OldwhiteCastleQueen; + bool OldblackCastleKing; + bool OldblackCastleQueen; + int oldHalfMoveClock; int oldMoveClock; uint64_t zobristKey; GameState oldState; + + // castling + bool wasCastle = false; + bool CastledSide = false; // 0 for queen side, 1 for king side }; -Piece createPiece(PieceType type, bool color, bool moved = false); +Piece createPiece(PieceType type, bool color); int PositionToIndex(Position i); UndoMove MakeMove(Move move, Game *g); -- cgit v1.2.3