X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=a3ce4c2d3a49c2a257dc9a74a35e5e3f3a2aa7bf;hp=e57131eb7bf0330eba5ab434c24fdbe36344d538;hb=190f38a7c2a64f7e89f06871533d87ba7b287fdc;hpb=66820a2668a7892a0eb49bedc0ed2c3b4baa74a7 diff --git a/src/search.cpp b/src/search.cpp index e57131eb..a3ce4c2d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -71,7 +71,7 @@ namespace { int Reductions[MAX_MOVES]; // [depth or moveNumber] Depth reduction(bool i, Depth d, int mn) { - int r = Reductions[d / ONE_PLY] * Reductions[mn] / 1024; + int r = Reductions[d / ONE_PLY] * Reductions[mn]; return ((r + 512) / 1024 + (!i && r > 1024)) * ONE_PLY; } @@ -149,7 +149,7 @@ namespace { void Search::init() { for (int i = 1; i < MAX_MOVES; ++i) - Reductions[i] = int(1024 * std::log(i) / std::sqrt(1.95)); + Reductions[i] = int(22.9 * std::log(i)); } @@ -239,19 +239,19 @@ void MainThread::search() { for (Thread* th: Threads) minScore = std::min(minScore, th->rootMoves[0].score); - // Vote according to score and depth + // Vote according to score and depth, and select the best thread + int64_t bestVote = 0; for (Thread* th : Threads) + { votes[th->rootMoves[0].pv[0]] += (th->rootMoves[0].score - minScore + 14) * int(th->completedDepth); - // Select best thread - auto 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; } + } } previousScore = bestThread->rootMoves[0].score; @@ -404,17 +404,14 @@ void Thread::search() { beta = (alpha + beta) / 2; alpha = std::max(bestValue - delta, -VALUE_INFINITE); + failedHighCnt = 0; if (mainThread) - { - failedHighCnt = 0; mainThread->stopOnPonderhit = false; - } } else if (bestValue >= beta) { beta = std::min(bestValue + delta, VALUE_INFINITE); - if (mainThread) - ++failedHighCnt; + ++failedHighCnt; } else break;