+ // Calculate depth dependant futility pruning parameters
+ const int FutilityMoveCountMargin = 3 + (1 << (3 * int(depth) / 8));
+ const int PostFutilityValueMargin = 112 * bitScanReverse32(int(depth) * int(depth) / 2);
+
+ // Evaluate the position statically
+ if (!isCheck)
+ {
+ if (tte && (tte->type() & VALUE_TYPE_EVAL))
+ staticValue = value_from_tt(tte->value(), ply);
+ else
+ {
+ staticValue = evaluate(pos, ei, threadID);
+ ss[ply].evalInfo = &ei;
+ }
+
+ ss[ply].eval = staticValue;
+ futilityValue = staticValue + PostFutilityValueMargin; //FIXME: Remove me, only for split
+ staticValue = refine_eval(tte, staticValue, ply); // Enhance accuracy with TT value if possible
+ update_gains(pos, ss[ply - 1].currentMove, ss[ply - 1].eval, ss[ply].eval);
+ }
+
+ // Post futility pruning
+ if (depth < SelectiveDepth && staticValue - PostFutilityValueMargin >= beta)
+ return (staticValue - PostFutilityValueMargin);
+