X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=72ec79e71f3e95539d0b05776147d3d51a040d41;hp=da22c5cff066f505ba5eed5537904fc0ed97d32b;hb=bbd69c0260a12cedf2b4d32b9ec3d478270533ce;hpb=b8cfc255d46113573a0869e56224a382c74dfcdc diff --git a/src/search.cpp b/src/search.cpp index da22c5cf..72ec79e7 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -185,6 +185,10 @@ void Search::think() { RootColor = RootPos.side_to_move(); TimeMgr.init(Limits, RootPos.game_ply(), RootColor); + int cf = Options["Contempt Factor"] * PawnValueMg / 100; // From centipawns + DrawValue[ RootColor] = VALUE_DRAW - Value(cf); + DrawValue[~RootColor] = VALUE_DRAW + Value(cf); + if (RootMoves.empty()) { RootMoves.push_back(MOVE_NONE); @@ -206,16 +210,6 @@ void Search::think() { } } - if (Options["Contempt Factor"] && !Options["UCI_AnalyseMode"]) - { - int cf = Options["Contempt Factor"] * PawnValueMg / 100; // From centipawns - cf = cf * Material::game_phase(RootPos) / PHASE_MIDGAME; // Scale down with phase - DrawValue[ RootColor] = VALUE_DRAW - Value(cf); - DrawValue[~RootColor] = VALUE_DRAW + Value(cf); - } - else - DrawValue[WHITE] = DrawValue[BLACK] = VALUE_DRAW; - if (Options["Write Search Log"]) { Log log(Options["Search Log Filename"]); @@ -668,7 +662,7 @@ namespace { && !ss->skipNullMove && abs(beta) < VALUE_MATE_IN_MAX_PLY) { - Value rbeta = beta + 200; + Value rbeta = std::min(beta + 200, VALUE_INFINITE); Depth rdepth = depth - ONE_PLY - 3 * ONE_PLY; assert(rdepth >= ONE_PLY);