Skip to content

Commit

Permalink
Late Move reduction and continuation history
Browse files Browse the repository at this point in the history
Update continuation history after LMR-triggered full depth research.
Directly after a LMR-triggered full depth research, we update the
continuation history for quiet moves (but with only half stat bonus).

STC:
LLR: 2.96 (-2.94,2.94) [0.50,4.50]
Total: 39657 W: 8966 L: 8604 D: 22087
http://tests.stockfishchess.org/tests/view/5d279fa40ebc5925cf0d4566

LTC:
LLR: 2.96 (-2.94,2.94) [0.50,3.50]
Total: 32582 W: 5740 L: 5427 D: 21415
http://tests.stockfishchess.org/tests/view/5d27dbf90ebc5925cf0d4b7e

Bench: 3239357
  • Loading branch information
locutus2 authored and snicolet committed Jul 12, 2019
1 parent 82d66f6 commit 389e607
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/search.cpp
Expand Up @@ -578,7 +578,7 @@ namespace {
Move ttMove, move, excludedMove, bestMove;
Depth extension, newDepth;
Value bestValue, value, ttValue, eval, maxValue;
bool ttHit, ttPv, inCheck, givesCheck, improving;
bool ttHit, ttPv, inCheck, givesCheck, improving, doLMR;
bool captureOrPromotion, doFullDepthSearch, moveCountPruning, ttCapture;
Piece movedPiece;
int moveCount, captureCount, quietCount, singularLMR;
Expand Down Expand Up @@ -1122,15 +1122,26 @@ namespace {

value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d, true);

doFullDepthSearch = (value > alpha && d != newDepth);
doFullDepthSearch = (value > alpha && d != newDepth), doLMR = true;
}
else
doFullDepthSearch = !PvNode || moveCount > 1;
doFullDepthSearch = !PvNode || moveCount > 1, doLMR = false;

// Step 17. Full depth search when LMR is skipped or fails high
if (doFullDepthSearch)
{
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode);

if (doLMR && !captureOrPromotion)
{
int bonus = stat_bonus(newDepth) / 2;
if (value <= alpha)
bonus = -bonus;

update_continuation_histories(ss, movedPiece, to_sq(move), bonus);
}
}

// For PV nodes only, do a full PV search on the first move or after a fail
// high (in the latter case search only if value < beta), otherwise let the
// parent node fail low with value <= alpha and try another move.
Expand Down

0 comments on commit 389e607

Please sign in to comment.