Skip to content

Commit 195a4fe

Browse files
Vizvezdenecvondele
authored andcommitted
Introduce capture history pruning
This patch introduces a heuristic that is similar to countermove based pruning but for captures - capture history pruning. The idea is that we can (almost) safely prune really late captures with negative history if they don't give check so will most likely not produce some king-attacking tactic. passed STC https://tests.stockfishchess.org/tests/view/5e8c60d40ffd2be7f15e5470 LLR: 2.94 (-2.94,2.94) {-0.50,1.50} Total: 23748 W: 4758 L: 4529 D: 14461 Ptnml(0-2): 421, 2712, 5400, 2899, 442 passed LTC https://tests.stockfishchess.org/tests/view/5e8c72bf0ffd2be7f15e547f LLR: 2.96 (-2.94,2.94) {0.25,1.75} Total: 17330 W: 2415 L: 2190 D: 12725 Ptnml(0-2): 126, 1561, 5107, 1704, 167 closes #2618 bench 4417023
1 parent 85bcf47 commit 195a4fe

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

src/search.cpp

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,8 @@ namespace {
789789
}
790790
}
791791

792+
CapturePieceToHistory& captureHistory = thisThread->captureHistory;
793+
792794
// Step 6. Static evaluation of the position
793795
if (inCheck)
794796
{
@@ -899,7 +901,7 @@ namespace {
899901
&& abs(beta) < VALUE_TB_WIN_IN_MAX_PLY)
900902
{
901903
Value raisedBeta = std::min(beta + 189 - 45 * improving, VALUE_INFINITE);
902-
MovePicker mp(pos, ttMove, raisedBeta - ss->staticEval, &thisThread->captureHistory);
904+
MovePicker mp(pos, ttMove, raisedBeta - ss->staticEval, &captureHistory);
903905
int probCutCount = 0;
904906

905907
while ( (move = mp.next_move()) != MOVE_NONE
@@ -954,7 +956,7 @@ namespace {
954956

955957
MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory,
956958
&thisThread->lowPlyHistory,
957-
&thisThread->captureHistory,
959+
&captureHistory,
958960
contHist,
959961
countermove,
960962
ss->killers,
@@ -1010,12 +1012,12 @@ namespace {
10101012
// Skip quiet moves if movecount exceeds our FutilityMoveCount threshold
10111013
moveCountPruning = moveCount >= futility_move_count(improving, depth);
10121014

1015+
// Reduced depth of the next LMR search
1016+
int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount), 0);
1017+
10131018
if ( !captureOrPromotion
10141019
&& !givesCheck)
10151020
{
1016-
// Reduced depth of the next LMR search
1017-
int lmrDepth = std::max(newDepth - reduction(improving, depth, moveCount), 0);
1018-
10191021
// Countermoves based pruning (~20 Elo)
10201022
if ( lmrDepth < 4 + ((ss-1)->statScore > 0 || (ss-1)->moveCount == 1)
10211023
&& (*contHist[0])[movedPiece][to_sq(move)] < CounterMovePruneThreshold
@@ -1035,8 +1037,16 @@ namespace {
10351037
if (!pos.see_ge(move, Value(-(32 - std::min(lmrDepth, 18)) * lmrDepth * lmrDepth)))
10361038
continue;
10371039
}
1038-
else if (!pos.see_ge(move, Value(-194) * depth)) // (~25 Elo)
1039-
continue;
1040+
else
1041+
{
1042+
if ( !givesCheck
1043+
&& lmrDepth < 1
1044+
&& captureHistory[movedPiece][to_sq(move)][type_of(pos.piece_on(to_sq(move)))] < 0)
1045+
continue;
1046+
1047+
if (!pos.see_ge(move, Value(-194) * depth)) // (~25 Elo)
1048+
continue;
1049+
}
10401050
}
10411051

10421052
// Step 14. Extensions (~75 Elo)

0 commit comments

Comments
 (0)