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

Bonus for a prior capture that causes a fail low.

This tweak adds a bonus equal to twice the stat_bonus for the current depth for a prior capture that caused a fail high, similar to the prior countermove bonus we currently have.

Passed STC
https://tests.stockfishchess.org/tests/view/673bc14b86d5ee47d953f1f2
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 105824 W: 27538 L: 27118 D: 51168
Ptnml(0-2): 358, 12370, 27024, 12814, 346

Passed LTC
https://tests.stockfishchess.org/tests/view/673ccbff86d5ee47d953f2d9
LLR: 2.94 (-2.94,2.94) <0.50,2.50>
Total: 134502 W: 34340 L: 33820 D: 66342
Ptnml(0-2): 102, 14634, 37229, 15214, 72

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

Bench: 1107054
This commit is contained in:
Daniel Monroe 2024-11-22 16:56:50 -08:00 committed by Disservin
parent 55905e562a
commit 70bb317afe
2 changed files with 17 additions and 5 deletions

View file

@ -538,7 +538,7 @@ Value Search::Worker::search(
// Dive into quiescence search when the depth reaches zero // Dive into quiescence search when the depth reaches zero
if (depth <= 0) if (depth <= 0)
return qsearch<PvNode ? PV : NonPV>(pos, ss, alpha, beta); return qsearch < PvNode ? PV : NonPV > (pos, ss, alpha, beta);
// Limit the depth if extensions made it too large // Limit the depth if extensions made it too large
depth = std::min(depth, MAX_PLY - 1); depth = std::min(depth, MAX_PLY - 1);
@ -890,6 +890,7 @@ Value Search::Worker::search(
prefetch(tt.first_entry(pos.key_after(move))); prefetch(tt.first_entry(pos.key_after(move)));
ss->currentMove = move; ss->currentMove = move;
ss->capturedPiece = captured;
ss->continuationHistory = ss->continuationHistory =
&this->continuationHistory[ss->inCheck][true][pos.moved_piece(move)][move.to_sq()]; &this->continuationHistory[ss->inCheck][true][pos.moved_piece(move)][move.to_sq()];
ss->continuationCorrectionHistory = ss->continuationCorrectionHistory =
@ -1139,6 +1140,7 @@ moves_loop: // When in check, search starts here
// Update the current move (this must be done after singular extension search) // Update the current move (this must be done after singular extension search)
ss->currentMove = move; ss->currentMove = move;
ss->capturedPiece = pos.piece_on(move.to_sq());
ss->continuationHistory = ss->continuationHistory =
&thisThread->continuationHistory[ss->inCheck][capture][movedPiece][move.to_sq()]; &thisThread->continuationHistory[ss->inCheck][capture][movedPiece][move.to_sq()];
ss->continuationCorrectionHistory = ss->continuationCorrectionHistory =
@ -1400,6 +1402,14 @@ moves_loop: // When in check, search starts here
<< stat_bonus(depth) * bonus / 24; << stat_bonus(depth) * bonus / 24;
} }
else if (priorCapture && prevSq != SQ_NONE)
{
// bonus for prior countermoves that caused the fail low
Piece capturedPiece = (ss - 1)->capturedPiece;
thisThread->captureHistory[pos.piece_on(prevSq)][prevSq][type_of(capturedPiece)]
<< stat_bonus(depth) * 2;
}
// Bonus when search fails low and there is a TT move // Bonus when search fails low and there is a TT move
else if (ttData.move && !allNode) else if (ttData.move && !allNode)
thisThread->mainHistory[us][ttData.move.from_to()] << stat_bonus(depth) * 23 / 100; thisThread->mainHistory[us][ttData.move.from_to()] << stat_bonus(depth) * 23 / 100;
@ -1645,6 +1655,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta)
// Update the current move // Update the current move
ss->currentMove = move; ss->currentMove = move;
ss->capturedPiece = pos.piece_on(move.to_sq());
ss->continuationHistory = ss->continuationHistory =
&thisThread &thisThread
->continuationHistory[ss->inCheck][capture][pos.moved_piece(move)][move.to_sq()]; ->continuationHistory[ss->inCheck][capture][pos.moved_piece(move)][move.to_sq()];

View file

@ -66,6 +66,7 @@ struct Stack {
CorrectionHistory<PieceTo>* continuationCorrectionHistory; CorrectionHistory<PieceTo>* continuationCorrectionHistory;
int ply; int ply;
Move currentMove; Move currentMove;
Piece capturedPiece;
Move excludedMove; Move excludedMove;
Value staticEval; Value staticEval;
int statScore; int statScore;