1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Small cleanup for stats adjustments

After some simplifications bonuses and maluses are the same for quiet
and non-quiet moves so it makes no sense to use quietMoveBonus/Malus,
instead use just bonus/malus.

closes https://github.com/official-stockfish/Stockfish/pull/5649

No functional change
This commit is contained in:
Michael Chaly 2024-10-21 10:42:31 +03:00 committed by Disservin
parent c15113554f
commit 8ef403c786

View file

@ -1791,35 +1791,35 @@ void update_all_stats(const Position& pos,
Piece moved_piece = pos.moved_piece(bestMove);
PieceType captured;
int quietMoveBonus = stat_bonus(depth);
int quietMoveMalus = stat_malus(depth);
int bonus = stat_bonus(depth);
int malus = stat_malus(depth);
if (!pos.capture_stage(bestMove))
{
update_quiet_histories(pos, ss, workerThread, bestMove, quietMoveBonus);
update_quiet_histories(pos, ss, workerThread, bestMove, bonus);
// Decrease stats for all non-best quiet moves
for (Move move : quietsSearched)
update_quiet_histories(pos, ss, workerThread, move, -quietMoveMalus);
update_quiet_histories(pos, ss, workerThread, move, -malus);
}
else
{
// Increase stats for the best move in case it was a capture move
captured = type_of(pos.piece_on(bestMove.to_sq()));
captureHistory[moved_piece][bestMove.to_sq()][captured] << quietMoveBonus;
captureHistory[moved_piece][bestMove.to_sq()][captured] << bonus;
}
// Extra penalty for a quiet early move that was not a TT move in
// previous ply when it gets refuted.
if (prevSq != SQ_NONE && ((ss - 1)->moveCount == 1 + (ss - 1)->ttHit) && !pos.captured_piece())
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -quietMoveMalus);
update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -malus);
// Decrease stats for all non-best capture moves
for (Move move : capturesSearched)
{
moved_piece = pos.moved_piece(move);
captured = type_of(pos.piece_on(move.to_sq()));
captureHistory[moved_piece][move.to_sq()][captured] << -quietMoveMalus;
captureHistory[moved_piece][move.to_sq()][captured] << -malus;
}
}