+
+
+/// History::set_gain() and History::gain() store and retrieve the
+/// gain of a move given the delta of the static position evaluations
+/// before and after the move.
+
+void History::set_gain(Piece p, Square from, Square to, Value delta)
+{
+ if (delta >= maxStaticValueDelta[p][from][to])
+ maxStaticValueDelta[p][from][to] = delta;
+ else
+ maxStaticValueDelta[p][from][to]--;
+}
+
+Value History::gain(Piece p, Square from, Square to) const
+{
+ return Value(maxStaticValueDelta[p][from][to]);
+}