X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=6a39e688c62e1f5f68ca6ebf648ee78fa01a9124;hp=2b58eda81891fb2c2709e5096fdd1e4889adae91;hb=8631b08d9704dac256462f6b5b885a4d8b0a9165;hpb=3d2aab11d89493311e0908a9ee1a8288b9ff9b42 diff --git a/src/search.cpp b/src/search.cpp index 2b58eda8..6a39e688 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -116,28 +116,26 @@ namespace { void Search::init() { - int d; // depth (ONE_PLY == 2) - int hd; // half depth (ONE_PLY == 1) - int mc; // moveCount - // Init reductions array - for (hd = 1; hd < 64; ++hd) for (mc = 1; mc < 64; ++mc) - { - double pvRed = 0.00 + log(double(hd)) * log(double(mc)) / 3.00; - double nonPVRed = 0.33 + log(double(hd)) * log(double(mc)) / 2.25; + for (int d = 1; d < 64; ++d) + for (int mc = 1; mc < 64; ++mc) + { + double pvRed = 0.00 + log(double(d)) * log(double(mc)) / 3.00; + double nonPVRed = 0.33 + log(double(d)) * log(double(mc)) / 2.25; - Reductions[1][1][hd][mc] = int8_t( pvRed >= 1.0 ? pvRed + 0.5: 0); - Reductions[0][1][hd][mc] = int8_t(nonPVRed >= 1.0 ? nonPVRed + 0.5: 0); + Reductions[1][1][d][mc] = int8_t( pvRed >= 1.0 ? pvRed + 0.5: 0); + Reductions[0][1][d][mc] = int8_t(nonPVRed >= 1.0 ? nonPVRed + 0.5: 0); - Reductions[1][0][hd][mc] = Reductions[1][1][hd][mc]; - Reductions[0][0][hd][mc] = Reductions[0][1][hd][mc]; + Reductions[1][0][d][mc] = Reductions[1][1][d][mc]; + Reductions[0][0][d][mc] = Reductions[0][1][d][mc]; - if (Reductions[0][0][hd][mc] >= 2) - Reductions[0][0][hd][mc] += 1; - } + // Increase reduction when eval is not improving + if (Reductions[0][0][d][mc] >= 2) + Reductions[0][0][d][mc] += 1; + } // Init futility move count array - for (d = 0; d < 32; ++d) + for (int d = 0; d < 32; ++d) { FutilityMoveCounts[0][d] = int(2.4 + 0.773 * pow(d + 0.00, 1.8)); FutilityMoveCounts[1][d] = int(2.9 + 1.045 * pow(d + 0.49, 1.8));