X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=9165468ae0590e82740f53c7296f7aef9f7ce643;hp=39875cb460c6e2f3286fd8f80e1b81bf00c37284;hb=4d0981fef37c85edfd7a0e713d68a4542d7a6784;hpb=714e857c246879a513cdf0d3d3fe757a42d7030a diff --git a/src/search.cpp b/src/search.cpp index 39875cb4..9165468a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -71,8 +71,7 @@ namespace { return Value((175 - 50 * improving) * d / ONE_PLY); } - // Futility and reductions lookup tables, initialized at startup - int FutilityMoveCounts[2][16]; // [improving][depth] + // Reductions lookup table, initialized at startup int Reductions[64]; // [depth or moveNumber] template Depth reduction(bool i, Depth d, int mn) { @@ -80,6 +79,10 @@ namespace { return ((r + 512) / 1024 + (!i && r > 1024) - PvNode) * ONE_PLY; } + constexpr int futility_move_count(bool improving, int depth) { + return (5 + depth * depth) * (1 + improving) / 2; + } + // History and stats update bonus, based on depth int stat_bonus(Depth depth) { int d = depth / ONE_PLY; @@ -159,12 +162,6 @@ void Search::init() { for (int i = 1; i < 64; ++i) Reductions[i] = int(1024 * std::log(i) / std::sqrt(1.95)); - - for (int d = 0; d < 16; ++d) - { - FutilityMoveCounts[0][d] = int(2.4 + 0.74 * pow(d, 1.78)); - FutilityMoveCounts[1][d] = int(5.0 + 1.00 * pow(d, 2.00)); - } } @@ -917,12 +914,13 @@ moves_loop: // When in check, search starts from here && move == ttMove && !rootNode && !excludedMove // Avoid recursive singular search - && ttValue != VALUE_NONE + /* && ttValue != VALUE_NONE Already implicit in the next condition */ + && abs(ttValue) < VALUE_KNOWN_WIN && (tte->bound() & BOUND_LOWER) && tte->depth() >= depth - 3 * ONE_PLY && pos.legal(move)) { - Value singularBeta = std::max(ttValue - 2 * depth / ONE_PLY, -VALUE_MATE); + Value singularBeta = ttValue - 2 * depth / ONE_PLY; ss->excludedMove = move; value = search(pos, ss, singularBeta - 1, singularBeta, depth / 2, cutNode); ss->excludedMove = MOVE_NONE; @@ -957,8 +955,7 @@ moves_loop: // When in check, search starts from here && bestValue > VALUE_MATED_IN_MAX_PLY) { // Skip quiet moves if movecount exceeds our FutilityMoveCount threshold - moveCountPruning = depth < 16 * ONE_PLY - && moveCount >= FutilityMoveCounts[improving][depth / ONE_PLY]; + moveCountPruning = moveCount >= futility_move_count(improving,depth / ONE_PLY); if ( !captureOrPromotion && !givesCheck