X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=216964ab43d5434678695f1f9c88d076cb084243;hp=bb09df984b7d301b9c3c93d6faa9f9eded4a68ec;hb=56273fca1edc51ffa0efc73715609f428c000c97;hpb=64d29a633066e39b62af5ee0bbf32645994744ec diff --git a/src/search.cpp b/src/search.cpp index bb09df98..216964ab 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -45,6 +45,7 @@ namespace Search { Color RootColor; Time::point SearchTime; StateStackPtr SetupStates; + Value Contempt[2]; // [bestValue > VALUE_DRAW] } using std::string; @@ -185,9 +186,9 @@ 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); + DrawValue[0] = DrawValue[1] = VALUE_DRAW; + Contempt[0] = Options["Contempt Factor"] * PawnValueEg / 100; // From centipawns + Contempt[1] = (Options["Contempt Factor"] + 12) * PawnValueEg / 100; if (RootMoves.empty()) { @@ -339,6 +340,9 @@ namespace { { bestValue = search(pos, ss, alpha, beta, depth * ONE_PLY, false); + DrawValue[ RootColor] = VALUE_DRAW - Contempt[bestValue > VALUE_DRAW]; + DrawValue[~RootColor] = VALUE_DRAW + Contempt[bestValue > VALUE_DRAW]; + // Bring the best move to the front. It is critical that sorting // is done with a stable algorithm because all the values but the // first and eventually the new best one are set to -VALUE_INFINITE