From 4eb36e67eca586a662298bfe8cc5392fbfa698e0 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 15 Aug 2026 17:01:54 +0200 Subject: implementing memory optimazied move using uint16_t instead of a four integers and one byte --- src/board/board.hpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/board/board.hpp') diff --git a/src/board/board.hpp b/src/board/board.hpp index b27a9d1..b24811c 100644 --- a/src/board/board.hpp +++ b/src/board/board.hpp @@ -43,23 +43,13 @@ PieceType getPromotionTypeFromMove(uint16_t move); uint8_t getFromValueFromMove(uint16_t move); uint8_t getToValueFromMove(uint16_t move); -struct Move { - Position From; - Position To; - - PieceType promotion = NONEPIECE; - bool operator==(const Move &other) const { - return From == other.From && To == other.To && promotion == other.promotion; - } -}; - enum Flag : std::uint8_t { EXACT, LOWERBOUND, UPPERBOUND }; struct TranspositionsEntry { int depth = -1; int Eval = 0; Flag flag = EXACT; - Move bestMove = {}; + uint16_t bestMove = {}; }; struct Game { Piece pieces[64]; @@ -85,8 +75,8 @@ struct UndoMove { Piece movedPiece; Piece capturedPiece; - Position from; - Position to; + uint8_t from; + uint8_t to; bool wasEnPassantCapture = false; Position enPassantCapturedSquare; @@ -112,7 +102,7 @@ struct UndoMove { }; int PositionToIndex(Position i); -UndoMove MakeMove(Move move, Game *g); +UndoMove MakeMove(uint16_t move, Game *g); void UnMakeMove(UndoMove undo, Game *g); Position FindKing(Game *g, bool color); -- cgit v1.2.3