- tte->save(posKey, VALUE_NONE, ttPv, BOUND_NONE, DEPTH_NONE, MOVE_NONE, eval);
+ // Save static evaluation into transposition table
+ tte->save(posKey, VALUE_NONE, ss->ttPv, BOUND_NONE, DEPTH_NONE, MOVE_NONE, eval);
+ }
+
+ // Use static evaluation difference to improve quiet move ordering
+ if (is_ok((ss-1)->currentMove) && !(ss-1)->inCheck && !priorCapture)
+ {
+ int bonus = std::clamp(-depth * 4 * int((ss-1)->staticEval + ss->staticEval - 2 * Tempo), -1000, 1000);
+ thisThread->mainHistory[~us][from_to((ss-1)->currentMove)] << bonus;