+ // 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);
+
+ }
+