Skip to content

Commit c2d5070

Browse files
lonfom169vondele
authored andcommitted
Sometimes do a reduced search if LMR is skipped
If the node doesn't go through LMR and r is too big, reduce search depth by one ply. STC: LLR: 2.94 (-2.94,2.94) <0.00,2.00> Total: 664888 W: 176375 L: 175169 D: 313344 Ptnml(0-2): 1965, 73754, 179851, 74858, 2016 https://tests.stockfishchess.org/tests/view/6399414c93ed41c57ede8fb8 LTC: LLR: 2.94 (-2.94,2.94) <0.50,2.50> Total: 150784 W: 40553 L: 40031 D: 70200 Ptnml(0-2): 76, 14668, 45387, 15180, 81 https://tests.stockfishchess.org/tests/view/639dee6e11c576d919dc2b38 closes #4290 Bench: 3727508
1 parent 61ea153 commit c2d5070

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

src/search.cpp

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,62 +1120,62 @@ namespace {
11201120
// Step 16. Make the move
11211121
pos.do_move(move, st, givesCheck);
11221122

1123-
// Step 17. Late moves reduction / extension (LMR, ~98 Elo)
1124-
// We use various heuristics for the sons of a node after the first son has
1125-
// been searched. In general we would like to reduce them, but there are many
1126-
// cases where we extend a son if it has good chances to be "interesting".
1127-
if ( depth >= 2
1128-
&& moveCount > 1 + (PvNode && ss->ply <= 1)
1129-
&& ( !ss->ttPv
1130-
|| !capture
1131-
|| (cutNode && (ss-1)->moveCount > 1)))
1132-
{
1133-
Depth r = reduction(improving, depth, moveCount, delta, thisThread->rootDelta);
1123+
Depth r = reduction(improving, depth, moveCount, delta, thisThread->rootDelta);
11341124

1135-
// Decrease reduction if position is or has been on the PV
1136-
// and node is not likely to fail low. (~3 Elo)
1137-
if ( ss->ttPv
1138-
&& !likelyFailLow)
1139-
r -= 2;
1125+
// Decrease reduction if position is or has been on the PV
1126+
// and node is not likely to fail low. (~3 Elo)
1127+
if ( ss->ttPv
1128+
&& !likelyFailLow)
1129+
r -= 2;
11401130

1141-
// Decrease reduction if opponent's move count is high (~1 Elo)
1142-
if ((ss-1)->moveCount > 7)
1143-
r--;
1131+
// Decrease reduction if opponent's move count is high (~1 Elo)
1132+
if ((ss-1)->moveCount > 7)
1133+
r--;
11441134

1145-
// Increase reduction for cut nodes (~3 Elo)
1146-
if (cutNode)
1147-
r += 2;
1135+
// Increase reduction for cut nodes (~3 Elo)
1136+
if (cutNode)
1137+
r += 2;
11481138

1149-
// Increase reduction if ttMove is a capture (~3 Elo)
1150-
if (ttCapture)
1151-
r++;
1139+
// Increase reduction if ttMove is a capture (~3 Elo)
1140+
if (ttCapture)
1141+
r++;
11521142

1153-
// Decrease reduction for PvNodes based on depth
1154-
if (PvNode)
1155-
r -= 1 + 11 / (3 + depth);
1143+
// Decrease reduction for PvNodes based on depth
1144+
if (PvNode)
1145+
r -= 1 + 11 / (3 + depth);
11561146

1157-
// Decrease reduction if ttMove has been singularly extended (~1 Elo)
1158-
if (singularQuietLMR)
1159-
r--;
1147+
// Decrease reduction if ttMove has been singularly extended (~1 Elo)
1148+
if (singularQuietLMR)
1149+
r--;
11601150

1161-
// Decrease reduction if we move a threatened piece (~1 Elo)
1162-
if ( depth > 9
1163-
&& (mp.threatenedPieces & from_sq(move)))
1164-
r--;
1151+
// Decrease reduction if we move a threatened piece (~1 Elo)
1152+
if ( depth > 9
1153+
&& (mp.threatenedPieces & from_sq(move)))
1154+
r--;
11651155

1166-
// Increase reduction if next ply has a lot of fail high
1167-
if ((ss+1)->cutoffCnt > 3)
1168-
r++;
1156+
// Increase reduction if next ply has a lot of fail high
1157+
if ((ss+1)->cutoffCnt > 3)
1158+
r++;
11691159

1170-
ss->statScore = 2 * thisThread->mainHistory[us][from_to(move)]
1171-
+ (*contHist[0])[movedPiece][to_sq(move)]
1172-
+ (*contHist[1])[movedPiece][to_sq(move)]
1173-
+ (*contHist[3])[movedPiece][to_sq(move)]
1174-
- 4433;
1160+
ss->statScore = 2 * thisThread->mainHistory[us][from_to(move)]
1161+
+ (*contHist[0])[movedPiece][to_sq(move)]
1162+
+ (*contHist[1])[movedPiece][to_sq(move)]
1163+
+ (*contHist[3])[movedPiece][to_sq(move)]
1164+
- 4433;
11751165

1176-
// Decrease/increase reduction for moves with a good/bad history (~30 Elo)
1177-
r -= ss->statScore / (13000 + 4152 * (depth > 7 && depth < 19));
1166+
// Decrease/increase reduction for moves with a good/bad history (~30 Elo)
1167+
r -= ss->statScore / (13000 + 4152 * (depth > 7 && depth < 19));
11781168

1169+
// Step 17. Late moves reduction / extension (LMR, ~98 Elo)
1170+
// We use various heuristics for the sons of a node after the first son has
1171+
// been searched. In general we would like to reduce them, but there are many
1172+
// cases where we extend a son if it has good chances to be "interesting".
1173+
if ( depth >= 2
1174+
&& moveCount > 1 + (PvNode && ss->ply <= 1)
1175+
&& ( !ss->ttPv
1176+
|| !capture
1177+
|| (cutNode && (ss-1)->moveCount > 1)))
1178+
{
11791179
// In general we want to cap the LMR depth search at newDepth, but when
11801180
// reduction is negative, we allow this move a limited search extension
11811181
// beyond the first move depth. This may lead to hidden double extensions.
@@ -1209,10 +1209,10 @@ namespace {
12091209
}
12101210
}
12111211

1212-
// Step 18. Full depth search when LMR is skipped
1212+
// Step 18. Full depth search when LMR is skipped. If expected reduction is high, reduce its depth by 1.
12131213
else if (!PvNode || moveCount > 1)
12141214
{
1215-
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth, !cutNode);
1215+
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth - (r > 4), !cutNode);
12161216
}
12171217

12181218
// For PV nodes only, do a full PV search on the first move or after a fail

0 commit comments

Comments
 (0)