@@ -1120,62 +1120,62 @@ namespace {
1120
1120
// Step 16. Make the move
1121
1121
pos.do_move (move, st, givesCheck);
1122
1122
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 );
1134
1124
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 ;
1140
1130
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--;
1144
1134
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 ;
1148
1138
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++;
1152
1142
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);
1156
1146
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--;
1160
1150
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--;
1165
1155
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++;
1169
1159
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 ;
1175
1165
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 ));
1178
1168
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
+ {
1179
1179
// In general we want to cap the LMR depth search at newDepth, but when
1180
1180
// reduction is negative, we allow this move a limited search extension
1181
1181
// beyond the first move depth. This may lead to hidden double extensions.
@@ -1209,10 +1209,10 @@ namespace {
1209
1209
}
1210
1210
}
1211
1211
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.
1213
1213
else if (!PvNode || moveCount > 1 )
1214
1214
{
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);
1216
1216
}
1217
1217
1218
1218
// For PV nodes only, do a full PV search on the first move or after a fail
0 commit comments