diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 2f1d5067..a503b0c8 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -988,7 +988,9 @@ namespace { // Early exit if score is high auto lazy_skip = [&](Value lazyThreshold) { - return abs(mg_value(score) + eg_value(score)) > lazyThreshold + pos.non_pawn_material() / 32; + return abs(mg_value(score) + eg_value(score)) > lazyThreshold + + std::abs(pos.this_thread()->bestValue) * 5 / 4 + + pos.non_pawn_material() / 32; }; if (lazy_skip(LazyThreshold1)) @@ -1126,6 +1128,7 @@ std::string Eval::trace(Position& pos) { std::memset(scores, 0, sizeof(scores)); pos.this_thread()->trend = SCORE_ZERO; // Reset any dynamic contempt + pos.this_thread()->bestValue = VALUE_ZERO; // Reset bestValue for lazyEval v = Evaluation(pos).value(); diff --git a/src/search.cpp b/src/search.cpp index 090a7931..11d1df32 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -286,7 +286,7 @@ void Thread::search() { // The latter is needed for statScore and killer initialization. Stack stack[MAX_PLY+10], *ss = stack+7; Move pv[MAX_PLY+1]; - Value bestValue, alpha, beta, delta; + Value alpha, beta, delta; Move lastBestMove = MOVE_NONE; Depth lastBestMoveDepth = 0; MainThread* mainThread = (this == Threads.main() ? Threads.main() : nullptr); diff --git a/src/thread.h b/src/thread.h index fae866c4..38793739 100644 --- a/src/thread.h +++ b/src/thread.h @@ -64,6 +64,7 @@ public: uint64_t nodesLastExplosive; uint64_t nodesLastNormal; std::atomic nodes, tbHits, bestMoveChanges; + Value bestValue; int selDepth, nmpMinPly; Color nmpColor; ExplosionState state;