if (nullValue >= VALUE_MATE_IN_MAX_PLY)
nullValue = beta;
- if (abs(beta) < VALUE_KNOWN_WIN && (depth < 12 * ONE_PLY || thisThread->nmp_min_ply))
+ if (thisThread->nmp_min_ply || (abs(beta) < VALUE_KNOWN_WIN && depth < 12 * ONE_PLY))
return nullValue;
- // Do verification search at high depths. Disable null move pruning
- // for side to move for the first part of the remaining search tree.
+ assert(!thisThread->nmp_min_ply); // Recursive verification is not allowed
+
+ // Do verification search at high depths, with null move pruning disabled
+ // for us, until ply exceeds nmp_min_ply.
thisThread->nmp_min_ply = ss->ply + 3 * (depth-R) / 4 - 1;
thisThread->nmp_color = us;
if ( depth >= 8 * ONE_PLY
&& !ttMove)
{
- Depth d = 3 * depth / 4 - 2 * ONE_PLY;
- search<NT>(pos, ss, alpha, beta, d, cutNode);
+ search<NT>(pos, ss, alpha, beta, depth - 7 * ONE_PLY, cutNode);
tte = TT.probe(posKey, ttHit);
ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE;
Depth r = reduction<PvNode>(improving, depth, moveCount);
if (captureOrPromotion) // (~5 Elo)
+ {
+ //Increase reduction by comparing opponent's stat score
+ if ( (ss-1)->statScore >= 0
+ && thisThread->captureHistory[movedPiece][to_sq(move)][type_of(pos.captured_piece())] < 0)
+ r += ONE_PLY;
+
r -= r ? ONE_PLY : DEPTH_ZERO;
+ }
else
{
// Decrease reduction if opponent's move count is high (~5 Elo)