- // Enhance position with TT value if possible
- futilityValue = staticValue + FutilityValueMargin;
- staticValue = refine_eval(tte, staticValue, ply);
+ // 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 + FutilityValueMargin;
+ staticValue = refine_eval(tte, staticValue, ply); // Enhance accuracy with TT value if possible
+ }