From 3d26c811db8217b97bf694afe145e5c24f07f955 Mon Sep 17 00:00:00 2001 From: rektdie Date: Tue, 27 May 2025 22:53:16 +0200 Subject: [PATCH] fixed SEE | bench 3986957 --- source/search.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source/search.cpp b/source/search.cpp index c7021c0..646745e 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -533,6 +533,28 @@ SearchResults SearchPosition(Board &board, SearchParams params, SearchContext& c return results; } +int MoveEstimatedValue(Board& board, Move& move) { + int pieceType = board.GetPieceType(move.MoveTo()); + int value = pieceType != nullPieceType ? SEEPieceValues[pieceType] : 0; + + if (move.IsPromo()) { + int promoPiece = -1; + if (move.IsCapture()) { + promoPiece = move.GetFlags() - 9; + } else { + promoPiece = move.GetFlags() - 5; + } + + value += SEEPieceValues[promoPiece] - SEEPieceValues[Pawn]; + } else if (move.GetFlags() == epCapture) { + value = SEEPieceValues[Pawn]; + } else if (move.GetFlags() == queenCastle || move.GetFlags() == kingCastle) { + value = 0; + } + + return value; +} + template SearchResults PVS(Board&, int, int, int, int, SearchContext& ctx, bool cutnode); template SearchResults PVS(Board&, int, int, int, int, SearchContext& ctx, bool cutnode); template SearchResults PVS(Board&, int, int, int, int, SearchContext& ctx, bool cutnode);