Skip to content

Commit 9766db8

Browse files
VizvezdenecDisservin
authored andcommitted
Make low ply history size fixed
Size of low ply history should always be the same, so ensure it. closes #5630 No functional change
1 parent b261df9 commit 9766db8

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/movepick.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void MovePicker::score() {
179179
: pt == ROOK && bool(to & threatenedByMinor) ? 24335
180180
: 0);
181181

182-
if (ply < 4)
182+
if (ply < LOW_PLY_HISTORY_SIZE)
183183
m.value += 8 * (*lowPlyHistory)[ply][m.from_to()] / (1 + 2 * ply);
184184
}
185185

src/movepick.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace Stockfish {
3737
constexpr int PAWN_HISTORY_SIZE = 512; // has to be a power of 2
3838
constexpr int CORRECTION_HISTORY_SIZE = 32768; // has to be a power of 2
3939
constexpr int CORRECTION_HISTORY_LIMIT = 1024;
40+
constexpr int LOW_PLY_HISTORY_SIZE = 4;
4041

4142
static_assert((PAWN_HISTORY_SIZE & (PAWN_HISTORY_SIZE - 1)) == 0,
4243
"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
137138

138139
// LowPlyHistory is adressed by play and move's from and to squares, used
139140
// to improve move ordering near the root
140-
using LowPlyHistory = Stats<int16_t, 7183, 4, int(SQUARE_NB) * int(SQUARE_NB)>;
141+
using LowPlyHistory = Stats<int16_t, 7183, LOW_PLY_HISTORY_SIZE, int(SQUARE_NB) * int(SQUARE_NB)>;
141142

142143
// CapturePieceToHistory is addressed by a move's [piece][to][captured piece type]
143144
using CapturePieceToHistory = Stats<int16_t, 10692, PIECE_NB, SQUARE_NB, PIECE_TYPE_NB>;

src/search.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1851,7 +1851,7 @@ void update_quiet_histories(
18511851

18521852
Color us = pos.side_to_move();
18531853
workerThread.mainHistory[us][move.from_to()] << bonus;
1854-
if (ss->ply < 4)
1854+
if (ss->ply < LOW_PLY_HISTORY_SIZE)
18551855
workerThread.lowPlyHistory[ss->ply][move.from_to()] << bonus;
18561856

18571857
update_continuation_histories(ss, pos.moved_piece(move), move.to_sq(), bonus);

0 commit comments

Comments
 (0)