Code: Select all
// Step 6. Static evaluation of the position
if (inCheck) {
ss->staticEval = eval = VALUE_NONE;
improving = false;
goto moves_loop; // Skip early pruning when in check
}
else if (ttHit) {
// Never assume anything about values stored in TT
ss->staticEval = eval = tte->eval();
if (eval == VALUE_NONE)
ss->staticEval = eval = evaluate(pos);
if (eval == VALUE_DRAW)
eval = value_draw(thisThread);
// Can ttValue be used as a better position evaluation?
if ( ttValue != VALUE_NONE && (tte->bound() & (ttValue > eval ? BOUND_LOWER:BOUND_UPPER)))
eval = ttValue;
}
else{
if ((ss-1)->currentMove != MOVE_NULL) {
int bonus = -(ss-1)->statScore / 512;
ss->staticEval = eval = evaluate(pos) + bonus;
}
else
ss->staticEval = eval = -(ss-1)->staticEval + 2 * Eval::Tempo;
tte->save(posKey, VALUE_NONE, ttPv, BOUND_NONE, DEPTH_NONE, MOVE_NONE, eval);
}
Why here ? why only here (and not also when ttHit with VALUE_NONE ?