diff options
| author | Adam <adammegarules1@gmail.com> | 2026-08-15 17:01:54 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-08-15 17:01:54 +0200 |
| commit | 4eb36e67eca586a662298bfe8cc5392fbfa698e0 (patch) | |
| tree | 6c232d59d1566377fbaeec035f4f799618f63421 /src/board/board.hpp | |
| parent | c1d6113da12bfbe92ae718d93dd56e25556e52cb (diff) | |
implementing memory optimazied move using uint16_t instead of a four integers and one byte
Diffstat (limited to 'src/board/board.hpp')
| -rw-r--r-- | src/board/board.hpp | 18 |
1 files changed, 4 insertions, 14 deletions
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); |
