}
return (pos.side_to_move() == WHITE ? v : -v) // Side to move point of view
- + Eval::Tempo;
+ + Eval::tempo_value(pos);
}
} // namespace
+/// tempo_value() returns the evaluation offset for the side to move
+
+Value Eval::tempo_value(const Position& pos) {
+ return Tempo * (1 + 4 * pos.captures_to_hand());
+}
+
+
/// evaluate() is the evaluator for the outer world. It returns a static
/// evaluation of the position from the point of view of the side to move.
std::string trace(const Position& pos);
+Value tempo_value(const Position& pos);
Value evaluate(const Position& pos);
}
{
ss->staticEval = eval =
(ss-1)->currentMove != MOVE_NULL ? evaluate(pos)
- : -(ss-1)->staticEval + 2 * Eval::Tempo;
+ : -(ss-1)->staticEval + 2 * Eval::tempo_value(pos);
tte->save(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE,
ss->staticEval, TT.generation());
else
ss->staticEval = bestValue =
(ss-1)->currentMove != MOVE_NULL ? evaluate(pos)
- : -(ss-1)->staticEval + 2 * Eval::Tempo;
+ : -(ss-1)->staticEval + 2 * Eval::tempo_value(pos);
// Stand pat. Return immediately if static value is at least beta
if (bestValue >= beta)