assert(probCutBeta < VALUE_INFINITE);
MovePicker mp(pos, ttMove, probCutBeta - ss->staticEval, depth - 3, &captureHistory);
- bool ttPv = ss->ttPv;
- ss->ttPv = false;
while ((move = mp.next_move()) != MOVE_NONE)
if (move != excludedMove && pos.legal(move))
if (value >= probCutBeta)
{
- // if transposition table doesn't have equal or more deep info write probCut data into it
- if (!( ss->ttHit
- && tte->depth() >= depth - 3
- && ttValue != VALUE_NONE))
- tte->save(posKey, value_to_tt(value, ss->ply), ttPv,
- BOUND_LOWER, depth - 3, move, ss->staticEval);
+ // Save ProbCut data into transposition table
+ tte->save(posKey, value_to_tt(value, ss->ply), ss->ttPv, BOUND_LOWER, depth - 3, move, ss->staticEval);
return value;
}
}
- ss->ttPv = ttPv;
}
// Step 11. If the position is not in TT, decrease depth by 3.
// Decrease/increase reduction for moves with a good/bad history (~30 Elo)
r -= ss->statScore / 15914;
- // In general we want to cap the LMR depth search at newDepth. But if reductions
- // are really negative and movecount is low, we allow this move to be searched
- // deeper than the first move (this may lead to hidden double extensions).
- int deeper = r >= -1 ? 0
- : moveCount <= 4 ? 2
- : PvNode || cutNode ? 1
- : 0;
-
- Depth d = std::clamp(newDepth - r, 1, newDepth + deeper);
+ // In general we want to cap the LMR depth search at newDepth, but when
+ // reduction is negative, we allow this move a limited search extension
+ // beyond the first move depth. This may lead to hidden double extensions.
+ Depth d = std::clamp(newDepth - r, 1, newDepth + 1);
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d, true);