1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Use capture history to better judge which sacrifices to explore

This idea has been bouncing around a while. @Vizvezdenec tried it a
couple years ago in Stockfish without results, but its recent arrival in
Ethereal inspired him and thence me to try it afresh in Stockfish.

(Also factor out the now-common code with futpruning for captures.)

STC:
https://tests.stockfishchess.org/tests/view/662355bc3fe04ce4cefc18ac
LLR: 2.92 (-2.94,2.94) <0.00,2.00>
Total: 45760 W: 11970 L: 11640 D: 22150
Ptnml(0-2): 124, 5371, 11625, 5571, 189

LTC:
https://tests.stockfishchess.org/tests/view/662dda396115ff6764c817c9
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 243828 W: 62042 L: 61287 D: 120499
Ptnml(0-2): 211, 27202, 66329, 27965, 207

closes https://github.com/official-stockfish/Stockfish/pull/5200

Bench: 1480008
This commit is contained in:
Dubslow 2024-04-20 00:29:01 -05:00 committed by Disservin
parent 0fe6428645
commit 5d72032559

View file

@ -967,20 +967,22 @@ moves_loop: // When in check, search starts here
if (capture || givesCheck)
{
Piece capturedPiece = pos.piece_on(move.to_sq());
int captHist =
thisThread->captureHistory[movedPiece][move.to_sq()][type_of(capturedPiece)];
// Futility pruning for captures (~2 Elo)
if (!givesCheck && lmrDepth < 7 && !ss->inCheck)
{
Piece capturedPiece = pos.piece_on(move.to_sq());
Value futilityValue =
ss->staticEval + 285 + 277 * lmrDepth + PieceValue[capturedPiece]
+ thisThread->captureHistory[movedPiece][move.to_sq()][type_of(capturedPiece)]
/ 7;
Value futilityValue = ss->staticEval + 285 + 277 * lmrDepth
+ PieceValue[capturedPiece] + captHist / 7;
if (futilityValue <= alpha)
continue;
}
// SEE based pruning for captures and checks (~11 Elo)
if (!pos.see_ge(move, -203 * depth))
int seeHist = std::clamp(captHist / 32, -199 * depth, 199 * depth);
if (!pos.see_ge(move, -203 * depth - seeHist))
continue;
}
else