From 1ede13e85339ec5f7db33535d63326ba631fdcad Mon Sep 17 00:00:00 2001 From: Stefano Cardanobile Date: Thu, 1 Feb 2018 10:46:53 +0100 Subject: [PATCH] Merge from timeContempt --- src/search.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index b9ce9a62117..5d55830d9df 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -192,11 +192,6 @@ void MainThread::search() { Time.init(Limits, us, rootPos.game_ply()); TT.new_search(); - int contempt = Options["Contempt"] * PawnValueEg / 100; // From centipawns - - Eval::Contempt = (us == WHITE ? make_score(contempt, contempt / 2) - : -make_score(contempt, contempt / 2)); - if (rootMoves.empty()) { rootMoves.emplace_back(MOVE_NONE); @@ -341,6 +336,12 @@ void Thread::search() { delta = Value(18); alpha = std::max(rootMoves[PVIdx].previousScore - delta,-VALUE_INFINITE); beta = std::min(rootMoves[PVIdx].previousScore + delta, VALUE_INFINITE); + + // Adjust contempt based on current situation + int contempt = Options["Contempt"] * PawnValueEg / 100 + bestValue/10; // From centipawns + Eval::Contempt = (rootPos.side_to_move() == WHITE ? make_score(contempt, contempt / 2) + : -make_score(contempt, contempt / 2)); + } // Start with a small aspiration window and, in the case of a fail