X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=7392fada40a80b7c0c09c73bd2a12040b8f92006;hp=d61fca1bca5a3d5d91749f9ad2f1a1966f1349e4;hb=8de29390f2d2bd31585b93ff46eae3051126f666;hpb=4f6aa152284e80094467ea0051bb58b004042555 diff --git a/src/search.cpp b/src/search.cpp index d61fca1b..7392fada 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -179,22 +179,23 @@ namespace { void Search::init() { - const double K[][2] = {{ 0.799, 2.281 }, { 0.484, 3.023 }}; + const bool PV=true; - for (int pv = 0; pv <= 1; ++pv) - for (int imp = 0; imp <= 1; ++imp) - for (int d = 1; d < 64; ++d) - for (int mc = 1; mc < 64; ++mc) - { - double r = K[pv][0] + log(d) * log(mc) / K[pv][1]; - - if (r >= 1.5) - Reductions[pv][imp][d][mc] = int(r) * ONE_PLY; - - // Increase reduction when eval is not improving - if (!pv && !imp && Reductions[pv][imp][d][mc] >= 2 * ONE_PLY) - Reductions[pv][imp][d][mc] += ONE_PLY; - } + for (int imp = 0; imp <= 1; ++imp) + for (int d = 1; d < 64; ++d) + for (int mc = 1; mc < 64; ++mc) + { + double r = log(d) * log(mc) / 2; + if (r < 0.80) + continue; + + Reductions[!PV][imp][d][mc] = int(std::round(r)) * ONE_PLY; + Reductions[PV][imp][d][mc] = std::max(Reductions[!PV][imp][d][mc] - ONE_PLY, DEPTH_ZERO); + + // Increase reduction for non-PV nodes when eval is not improving + if (!imp && Reductions[!PV][imp][d][mc] >= 2 * ONE_PLY) + Reductions[!PV][imp][d][mc] += ONE_PLY; + } for (int d = 0; d < 16; ++d) { @@ -969,7 +970,7 @@ moves_loop: // When in check search starts from here && cmh[pos.moved_piece(move)][to_sq(move)] < VALUE_ZERO) continue; - predictedDepth = newDepth - reduction(improving, depth, moveCount); + predictedDepth = std::max(newDepth - reduction(improving, depth, moveCount), DEPTH_ZERO); // Futility pruning: parent node if (predictedDepth < 7 * ONE_PLY)