mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-24 02:57:11 +08:00
Integrate gains table in History
This will be useful to use gains table in move ordering along with history table. No functional change and big code remove. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -42,6 +42,7 @@ History::History() { clear(); }
|
||||
|
||||
void History::clear() {
|
||||
memset(history, 0, 2 * 8 * 64 * sizeof(int));
|
||||
memset(maxStaticValueDelta, 0, 16 * 64 * 64 * sizeof(int));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,3 +95,21 @@ int History::move_ordering_score(Piece p, Square to) const {
|
||||
|
||||
return history[p][to];
|
||||
}
|
||||
|
||||
|
||||
/// 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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user