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

Make low ply history size fixed

Size of low ply history should always be the same, so ensure it.

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

No functional change
This commit is contained in:
Michael Chaly 2024-10-12 08:32:15 +03:00 committed by Disservin
parent b261df970d
commit 9766db8139
3 changed files with 4 additions and 3 deletions

View file

@ -179,7 +179,7 @@ void MovePicker::score() {
: pt == ROOK && bool(to & threatenedByMinor) ? 24335 : pt == ROOK && bool(to & threatenedByMinor) ? 24335
: 0); : 0);
if (ply < 4) if (ply < LOW_PLY_HISTORY_SIZE)
m.value += 8 * (*lowPlyHistory)[ply][m.from_to()] / (1 + 2 * ply); m.value += 8 * (*lowPlyHistory)[ply][m.from_to()] / (1 + 2 * ply);
} }

View file

@ -37,6 +37,7 @@ namespace Stockfish {
constexpr int PAWN_HISTORY_SIZE = 512; // has to be a power of 2 constexpr int PAWN_HISTORY_SIZE = 512; // has to be a power of 2
constexpr int CORRECTION_HISTORY_SIZE = 32768; // has to be a power of 2 constexpr int CORRECTION_HISTORY_SIZE = 32768; // has to be a power of 2
constexpr int CORRECTION_HISTORY_LIMIT = 1024; constexpr int CORRECTION_HISTORY_LIMIT = 1024;
constexpr int LOW_PLY_HISTORY_SIZE = 4;
static_assert((PAWN_HISTORY_SIZE & (PAWN_HISTORY_SIZE - 1)) == 0, static_assert((PAWN_HISTORY_SIZE & (PAWN_HISTORY_SIZE - 1)) == 0,
"PAWN_HISTORY_SIZE has to be a power of 2"); "PAWN_HISTORY_SIZE has to be a power of 2");
@ -137,7 +138,7 @@ using ButterflyHistory = Stats<int16_t, 7183, COLOR_NB, int(SQUARE_NB) * int(SQU
// LowPlyHistory is adressed by play and move's from and to squares, used // LowPlyHistory is adressed by play and move's from and to squares, used
// to improve move ordering near the root // to improve move ordering near the root
using LowPlyHistory = Stats<int16_t, 7183, 4, int(SQUARE_NB) * int(SQUARE_NB)>; using LowPlyHistory = Stats<int16_t, 7183, LOW_PLY_HISTORY_SIZE, int(SQUARE_NB) * int(SQUARE_NB)>;
// CapturePieceToHistory is addressed by a move's [piece][to][captured piece type] // CapturePieceToHistory is addressed by a move's [piece][to][captured piece type]
using CapturePieceToHistory = Stats<int16_t, 10692, PIECE_NB, SQUARE_NB, PIECE_TYPE_NB>; using CapturePieceToHistory = Stats<int16_t, 10692, PIECE_NB, SQUARE_NB, PIECE_TYPE_NB>;

View file

@ -1851,7 +1851,7 @@ void update_quiet_histories(
Color us = pos.side_to_move(); Color us = pos.side_to_move();
workerThread.mainHistory[us][move.from_to()] << bonus; workerThread.mainHistory[us][move.from_to()] << bonus;
if (ss->ply < 4) if (ss->ply < LOW_PLY_HISTORY_SIZE)
workerThread.lowPlyHistory[ss->ply][move.from_to()] << bonus; workerThread.lowPlyHistory[ss->ply][move.from_to()] << bonus;
update_continuation_histories(ss, pos.moved_piece(move), move.to_sq(), bonus); update_continuation_histories(ss, pos.moved_piece(move), move.to_sq(), bonus);