X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=ab37e480fc5d50bdb10f79b6e3f08b8e2d0d1e5a;hp=8558bf155bb390d3ff4252d528768efdfeb5932c;hb=7618ee2df1e4e5a3fa6cd511cc42545a255eb9d2;hpb=661d48c27b6b95a743947fcf5ab25e82e6835512 diff --git a/src/search.cpp b/src/search.cpp index 8558bf15..ab37e480 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -215,12 +215,14 @@ namespace { // Step 14. Reduced search + int ReductionLevel = 2; // 0 = most aggressive reductions, 7 = minimum reductions + // Reduction lookup tables (initialized at startup) and their getter functions int8_t PVReductionMatrix[8][64][64]; // [depth][moveNumber] int8_t NonPVReductionMatrix[8][64][64]; // [depth][moveNumber] - inline Depth pv_reduction(Depth d, int mn) { return (Depth) PVReductionMatrix[0][Min(d / 2, 63)][Min(mn, 63)]; } - inline Depth nonpv_reduction(Depth d, int mn) { return (Depth) NonPVReductionMatrix[0][Min(d / 2, 63)][Min(mn, 63)]; } + inline Depth pv_reduction(Depth d, int mn) { return (Depth) PVReductionMatrix[ReductionLevel][Min(d / 2, 63)][Min(mn, 63)]; } + inline Depth nonpv_reduction(Depth d, int mn) { return (Depth) NonPVReductionMatrix[ReductionLevel][Min(d / 2, 63)][Min(mn, 63)]; } // Common adjustments @@ -671,6 +673,19 @@ namespace { beta = Min(ValueByIteration[Iteration - 1] + AspirationDelta, VALUE_INFINITE); } + // Choose optimum reduction level + ReductionLevel = 2; + + if (UseTimeManagement) + { + int level = int(floor(log(float(MaxSearchTime) / current_search_time()) / log(2.0) + 1.0)); + ReductionLevel = Min(Max(level, 0), 7); + } + else + { + //FIXME + } + // Search to the current depth, rml is updated and sorted, alpha and beta could change value = root_search(p, ss, rml, &alpha, &beta);