X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fsearch.cpp;h=ad54a7265417d12e4ea7994b4ea3baf34855af43;hb=e9aeaad05266ca557a9496b5a17b4c5f82f0e946;hp=50f3a01b5c2bdf54c97ab935c4f134aee67bf95e;hpb=ae0bb6dc2b490a8879279ee741d20fcdbbfe2fd3;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index 50f3a01b..ad54a726 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -319,6 +319,16 @@ void Thread::search() { multiPV = std::min(multiPV, rootMoves.size()); int ct = Options["Contempt"] * PawnValueEg / 100; // From centipawns + + // In analysis mode, adjust contempt in accordance with user preference + if (Limits.infinite || Options["UCI_AnalyseMode"]) + ct = Options["Analysis Contempt"] == "Off" ? 0 + : Options["Analysis Contempt"] == "Both" ? ct + : Options["Analysis Contempt"] == "White" && us == BLACK ? -ct + : Options["Analysis Contempt"] == "Black" && us == WHITE ? -ct + : ct; + + // In evaluate.cpp the evaluation is from the white point of view contempt = (us == WHITE ? make_score(ct, ct / 2) : -make_score(ct, ct / 2)); @@ -358,13 +368,11 @@ void Thread::search() { alpha = std::max(previousScore - delta,-VALUE_INFINITE); beta = std::min(previousScore + delta, VALUE_INFINITE); - ct = Options["Contempt"] * PawnValueEg / 100; // From centipawns - // Adjust contempt based on root move's previousScore (dynamic contempt) - ct += int(std::round(48 * atan(float(previousScore) / 128))); + int dct = ct + int(std::round(48 * atan(float(previousScore) / 128))); - contempt = (us == WHITE ? make_score(ct, ct / 2) - : -make_score(ct, ct / 2)); + contempt = (us == WHITE ? make_score(dct, dct / 2) + : -make_score(dct, dct / 2)); } // Start with a small aspiration window and, in the case of a fail