X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=eb3fc82a40862c24ec907b8bdd53c6d98a34ca08;hp=da22c5cff066f505ba5eed5537904fc0ed97d32b;hb=708cb311a040ca8c676524025c9d72ed4c632267;hpb=b8cfc255d46113573a0869e56224a382c74dfcdc diff --git a/src/search.cpp b/src/search.cpp index da22c5cf..eb3fc82a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -185,6 +185,11 @@ void Search::think() { RootColor = RootPos.side_to_move(); TimeMgr.init(Limits, RootPos.game_ply(), RootColor); + // Dynamic draw value: try to avoid repetition draws at early midgame + int cf = std::max(70 - RootPos.game_ply(), 0); + DrawValue[ RootColor] = VALUE_DRAW - Value(cf); + DrawValue[~RootColor] = VALUE_DRAW + Value(cf); + if (RootMoves.empty()) { RootMoves.push_back(MOVE_NONE); @@ -206,16 +211,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 +663,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);