X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=1aa3e92e69487b51e504acebc5e1127bb2b6f033;hp=ed01e0dee04c89d4f31dd29264ad576a441df89f;hb=2198cd0524574f0d9df8c0ec9aaf14ad8c94402b;hpb=be382bb0cf5927dc10ff9be882f6980a78d1484a diff --git a/src/search.cpp b/src/search.cpp index ed01e0de..1aa3e92e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -557,7 +557,7 @@ namespace { // search to overwrite a previous full search TT value, so we use a different // position key in case of an excluded move. excludedMove = ss->excludedMove; - posKey = pos.key() ^ Key(excludedMove); + posKey = pos.key() ^ Key(excludedMove << 16); // isn't a very good hash tte = TT.probe(posKey, ttHit); ttValue = ttHit ? value_from_tt(tte->value(), ss->ply) : VALUE_NONE; ttMove = rootNode ? thisThread->rootMoves[thisThread->PVIdx].pv[0] @@ -681,7 +681,8 @@ namespace { // Step 8. Null move search with verification search (is omitted in PV nodes) if ( !PvNode && eval >= beta - && ss->staticEval >= beta - 36 * depth / ONE_PLY + 225) + && ss->staticEval >= beta - 36 * depth / ONE_PLY + 225 + && (ss->ply >= thisThread->nmp_ply || ss->ply % 2 == thisThread->pair)) { assert(eval - beta >= 0); @@ -707,8 +708,17 @@ namespace { 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; + Value v = depth-R < ONE_PLY ? qsearch(pos, ss, beta-1, beta) : search(pos, ss, beta-1, beta, depth-R, false, true); + thisThread->pair = pair; + thisThread->nmp_ply = nmp_ply; if (v >= beta) return nullValue;