mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-06 10:53:50 +08:00
Introduce a constant for ValueList size in search()
Having the size of these lists in two separate places likely contributed to the crashes seen during the recent tuning attempt https://tests.stockfishchess.org/tests/view/685c413343ce022d15794536. Thanks to @MinetaS for spotting this. closes https://github.com/official-stockfish/Stockfish/pull/6142 No functional change
This commit is contained in:
committed by
Disservin
parent
3a0fff96cf
commit
84e2f3851d
@@ -63,6 +63,9 @@ using namespace Search;
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
constexpr int SEARCHEDLIST_CAPACITY = 32;
|
||||||
|
using SearchedList = ValueList<Move, SEARCHEDLIST_CAPACITY>;
|
||||||
|
|
||||||
// (*Scalers):
|
// (*Scalers):
|
||||||
// The values with Scaler asterisks have proven non-linear scaling.
|
// The values with Scaler asterisks have proven non-linear scaling.
|
||||||
// They are optimized to time controls of 180 + 1.8 and longer,
|
// They are optimized to time controls of 180 + 1.8 and longer,
|
||||||
@@ -119,16 +122,16 @@ void update_pv(Move* pv, Move move, const Move* childPv);
|
|||||||
void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus);
|
void update_continuation_histories(Stack* ss, Piece pc, Square to, int bonus);
|
||||||
void update_quiet_histories(
|
void update_quiet_histories(
|
||||||
const Position& pos, Stack* ss, Search::Worker& workerThread, Move move, int bonus);
|
const Position& pos, Stack* ss, Search::Worker& workerThread, Move move, int bonus);
|
||||||
void update_all_stats(const Position& pos,
|
void update_all_stats(const Position& pos,
|
||||||
Stack* ss,
|
Stack* ss,
|
||||||
Search::Worker& workerThread,
|
Search::Worker& workerThread,
|
||||||
Move bestMove,
|
Move bestMove,
|
||||||
Square prevSq,
|
Square prevSq,
|
||||||
ValueList<Move, 32>& quietsSearched,
|
SearchedList& quietsSearched,
|
||||||
ValueList<Move, 32>& capturesSearched,
|
SearchedList& capturesSearched,
|
||||||
Depth depth,
|
Depth depth,
|
||||||
Move TTMove,
|
Move TTMove,
|
||||||
int moveCount);
|
int moveCount);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
@@ -605,8 +608,8 @@ Value Search::Worker::search(
|
|||||||
int priorReduction;
|
int priorReduction;
|
||||||
Piece movedPiece;
|
Piece movedPiece;
|
||||||
|
|
||||||
ValueList<Move, 32> capturesSearched;
|
SearchedList capturesSearched;
|
||||||
ValueList<Move, 32> quietsSearched;
|
SearchedList quietsSearched;
|
||||||
|
|
||||||
// Step 1. Initialize node
|
// Step 1. Initialize node
|
||||||
Worker* thisThread = this;
|
Worker* thisThread = this;
|
||||||
@@ -1390,7 +1393,7 @@ moves_loop: // When in check, search starts here
|
|||||||
|
|
||||||
// If the move is worse than some previously searched move,
|
// If the move is worse than some previously searched move,
|
||||||
// remember it, to update its stats later.
|
// remember it, to update its stats later.
|
||||||
if (move != bestMove && moveCount <= 32)
|
if (move != bestMove && moveCount <= SEARCHEDLIST_CAPACITY)
|
||||||
{
|
{
|
||||||
if (capture)
|
if (capture)
|
||||||
capturesSearched.push_back(move);
|
capturesSearched.push_back(move);
|
||||||
@@ -1833,16 +1836,16 @@ void update_pv(Move* pv, Move move, const Move* childPv) {
|
|||||||
|
|
||||||
|
|
||||||
// Updates stats at the end of search() when a bestMove is found
|
// Updates stats at the end of search() when a bestMove is found
|
||||||
void update_all_stats(const Position& pos,
|
void update_all_stats(const Position& pos,
|
||||||
Stack* ss,
|
Stack* ss,
|
||||||
Search::Worker& workerThread,
|
Search::Worker& workerThread,
|
||||||
Move bestMove,
|
Move bestMove,
|
||||||
Square prevSq,
|
Square prevSq,
|
||||||
ValueList<Move, 32>& quietsSearched,
|
SearchedList& quietsSearched,
|
||||||
ValueList<Move, 32>& capturesSearched,
|
SearchedList& capturesSearched,
|
||||||
Depth depth,
|
Depth depth,
|
||||||
Move ttMove,
|
Move ttMove,
|
||||||
int moveCount) {
|
int moveCount) {
|
||||||
|
|
||||||
CapturePieceToHistory& captureHistory = workerThread.captureHistory;
|
CapturePieceToHistory& captureHistory = workerThread.captureHistory;
|
||||||
Piece movedPiece = pos.moved_piece(bestMove);
|
Piece movedPiece = pos.moved_piece(bestMove);
|
||||||
|
|||||||
Reference in New Issue
Block a user