+ // Calculate depth dependant futility pruning parameters
+ const int FutilityMoveCountMargin = 3 + (1 << (3 * int(depth) / 8));
+
+ // 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 + futility_margin(depth, 0); //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);
+ }
+
+ // Static null move pruning. We're betting that the opponent doesn't have
+ // a move that will reduce the score by more than FutilityMargins[int(depth)]
+ // if we do a null move.
+ if ( !isCheck
+ && allowNullmove
+ && depth < RazorDepth
+ && staticValue - futility_margin(depth, 0) >= beta)
+ return staticValue - futility_margin(depth, 0);
+