X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=c44d150f7008826abd9fe08ac4c1b0c4798e4985;hp=c894403cc452337c87abfc2d3cd99227b892a645;hb=3c7eebb48d5239cf363c54e082686f5559174518;hpb=c83fd08fd4fa91702ef0f727bc777c613524403d diff --git a/src/search.cpp b/src/search.cpp index c894403c..c44d150f 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -286,6 +286,7 @@ namespace { bool ok_to_prune(const Position& pos, Move m, Move threat); bool ok_to_use_TT(const TTEntry* tte, Depth depth, Value beta, int ply); Value refine_eval(const TTEntry* tte, Value defaultEval, int ply); + Depth calculate_reduction(double baseReduction, int moveCount, Depth depth, double reductionInhibitor); void update_history(const Position& pos, Move move, Depth depth, Move movesSearched[], int moveCount); void update_killers(Move m, SearchStack& ss); void update_gains(const Position& pos, Move move, Value before, Value after); @@ -999,6 +1000,7 @@ namespace { if (doFullDepthSearch) { + ss[0].reduction = Depth(0); value = -search(pos, ss, -alpha, newDepth, 1, true, 0); if (value > alpha) @@ -2679,6 +2681,20 @@ namespace { return defaultEval; } + // calculate_reduction() returns reduction in plies based on + // moveCount and depth. Reduction is always at least one ply. + + Depth calculate_reduction(double baseReduction, int moveCount, Depth depth, double reductionInhibitor) { + + double red = baseReduction + ln(moveCount) * ln(depth / 2) / reductionInhibitor; + + if (red >= 1.0) + return Depth(int(floor(red * int(OnePly)))); + else + return Depth(0); + + } + // update_history() registers a good move that produced a beta-cutoff // in history and marks as failures all the other moves of that ply.