if ( !PvNode
&& eval >= beta
&& ss->staticEval >= beta - 36 * depth / ONE_PLY + 225
- && (ss->ply >= thisThread->nmp_ply || ss->ply % 2 == thisThread->pair))
+ && (ss->ply >= thisThread->nmp_ply || ss->ply % 2 != thisThread->nmp_odd))
{
assert(eval - beta >= 0);
if (nullValue >= VALUE_MATE_IN_MAX_PLY)
nullValue = beta;
- if (depth < 12 * ONE_PLY && abs(beta) < VALUE_KNOWN_WIN)
+ if (abs(beta) < VALUE_KNOWN_WIN && (depth < 12 * ONE_PLY || thisThread->nmp_ply))
return nullValue;
// Do verification search at high depths
- R += ONE_PLY;
// disable null move pruning for side to move for the first part of the remaining search tree
- int nmp_ply = thisThread->nmp_ply;
- int pair = thisThread->pair;
thisThread->nmp_ply = ss->ply + 3 * (depth-R) / 4;
- thisThread->pair = (ss->ply % 2) == 0;
+ thisThread->nmp_odd = ss->ply % 2;
Value v = depth-R < ONE_PLY ? qsearch<NonPV, false>(pos, ss, beta-1, beta)
: search<NonPV>(pos, ss, beta-1, beta, depth-R, false, true);
- thisThread->pair = pair;
- thisThread->nmp_ply = nmp_ply;
+
+ thisThread->nmp_odd = thisThread->nmp_ply = 0;
if (v >= beta)
return nullValue;
for (Thread* th : *this)
{
- th->nodes = th->tbHits = 0;
+ th->nodes = th->tbHits = th->nmp_ply = th->nmp_odd = 0;
th->rootDepth = th->completedDepth = DEPTH_ZERO;
th->rootMoves = rootMoves;
th->rootPos.set(pos.fen(), pos.is_chess960(), &setupStates->back(), th);
- th->nmp_ply = 0;
- th->pair = -1;
}
setupStates->back() = tmp;
Material::Table materialTable;
Endgames endgames;
size_t PVIdx;
- int selDepth, nmp_ply, pair;
+ int selDepth, nmp_ply, nmp_odd;
std::atomic<uint64_t> nodes, tbHits;
Position rootPos;