X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=bd5eb2608cfa6714879d2cfd33b0e87ef5bc8a7c;hp=990c4123e6a91659ed0ab94baaca28a01ad8037d;hb=348cd5ed74e808733545c392d1bd80965a379617;hpb=d96c1c32a2fa109e7cc6cd07f6029cd13977121e diff --git a/src/search.cpp b/src/search.cpp index 990c4123..bd5eb260 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -66,7 +66,7 @@ namespace { constexpr int SkipPhase[] = { 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7 }; // Razor and futility margins - constexpr int RazorMargin[] = {0, 590, 604}; + constexpr int RazorMargin = 600; Value futility_margin(Depth d, bool improving) { return Value((175 - 50 * improving) * d / ONE_PLY); } @@ -250,26 +250,29 @@ void MainThread::search() { Value minScore = this->rootMoves[0].score; // Find out minimum score and reset votes for moves which can be voted - for (Thread* th: Threads){ + for (Thread* th: Threads) + { minScore = std::min(minScore, th->rootMoves[0].score); votes[th->rootMoves[0].pv[0]] = 0; } // Vote according to score and depth for (Thread* th : Threads) - votes[th->rootMoves[0].pv[0]] += int(th->rootMoves[0].score - minScore) + int(th->completedDepth); + votes[th->rootMoves[0].pv[0]] += int(th->rootMoves[0].score - minScore) + + int(th->completedDepth); // Select best thread int bestVote = votes[this->rootMoves[0].pv[0]]; - for (Thread* th : Threads){ - if (votes[th->rootMoves[0].pv[0]] > bestVote){ - bestVote = votes[th->rootMoves[0].pv[0]]; - bestThread = th; + for (Thread* th : Threads) + { + if (votes[th->rootMoves[0].pv[0]] > bestVote) + { + bestVote = votes[th->rootMoves[0].pv[0]]; + bestThread = th; } } } - previousScore = bestThread->rootMoves[0].score; // Send again PV info if we have a new best thread @@ -727,15 +730,9 @@ namespace { } // Step 7. Razoring (~2 Elo) - if ( !PvNode - && depth < 3 * ONE_PLY - && eval <= alpha - RazorMargin[depth / ONE_PLY]) - { - Value ralpha = alpha - (depth >= 2 * ONE_PLY) * RazorMargin[depth / ONE_PLY]; - Value v = qsearch(pos, ss, ralpha, ralpha+1); - if (depth < 2 * ONE_PLY || v <= ralpha) - return v; - } + if ( depth < 2 * ONE_PLY + && eval <= alpha - RazorMargin) + return qsearch(pos, ss, alpha, beta); improving = ss->staticEval >= (ss-2)->staticEval || (ss-2)->staticEval == VALUE_NONE; @@ -995,18 +992,12 @@ moves_loop: // When in check, search starts from here { Depth r = reduction(improving, depth, moveCount); - if (captureOrPromotion) // (~5 Elo) - { - // Decrease reduction by comparing opponent's stat score - if ((ss-1)->statScore < 0) - r -= ONE_PLY; - } - else - { - // Decrease reduction if opponent's move count is high (~5 Elo) - if ((ss-1)->moveCount > 15) - r -= ONE_PLY; + // Decrease reduction if opponent's move count is high (~10 Elo) + if ((ss-1)->moveCount > 15) + r -= ONE_PLY; + if (!captureOrPromotion) + { // Decrease reduction for exact PV nodes (~0 Elo) if (pvExact) r -= ONE_PLY;