assert(tte->static_value() != VALUE_NONE);
evalMargin = tte->static_value_margin();
- bestValue = tte->static_value();
+ ss->eval = bestValue = tte->static_value();
}
else
- bestValue = evaluate(pos, evalMargin);
+ ss->eval = bestValue = evaluate(pos, evalMargin);
- ss->eval = bestValue;
update_gains(pos, (ss-1)->currentMove, (ss-1)->eval, ss->eval);
// Stand pat. Return immediately if static value is at least beta
deepChecks = (depth == -ONE_PLY && bestValue >= beta - PawnValueMidgame / 8);
// Futility pruning parameters, not needed when in check
- futilityBase = bestValue + FutilityMarginQS + evalMargin;
+ futilityBase = ss->eval + evalMargin + FutilityMarginQS;
enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
}
}
}
- // Detect blocking evasions that are candidate to be pruned
+ // Detect non-capture evasions that are candidate to be pruned
evasionPrunable = isCheck
&& bestValue > value_mated_in(PLY_MAX)
&& !pos.move_is_capture(move)
ValueType vt = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT);
TT.store(pos.get_key(), value_to_tt(bestValue, ply), vt, d, ss->bestMove, ss->eval, evalMargin);
- // Update killers only for checking moves that fails high
- if ( bestValue >= beta
- && !pos.move_is_capture_or_promotion(ss->bestMove))
- update_killers(ss->bestMove, ss);
-
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
return bestValue;