Skip to content

Commit

Permalink
correct statscore
Browse files Browse the repository at this point in the history
bench 1292183
  • Loading branch information
xu-shawn committed Nov 9, 2024
1 parent 24c5779 commit 36ea174
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ Value Search::Worker::search(

// Dive into quiescence search when the depth reaches zero
if (depth <= 0)
return qsearch < PvNode ? PV : NonPV > (pos, ss, alpha, beta);
return qsearch<PvNode ? PV : NonPV>(pos, ss, alpha, beta);

// Limit the depth if extensions made it too large
depth = std::min(depth, MAX_PLY - 1);
Expand Down Expand Up @@ -805,6 +805,7 @@ Value Search::Worker::search(
Depth R = std::min(int(eval - beta) / 209, 6) + depth / 3 + 5;

ss->currentMove = Move::null();
ss->statScore = -78520;
ss->continuationHistory = &thisThread->continuationHistory[0][0][NO_PIECE][0];
ss->continuationCorrectionHistory = &thisThread->continuationCorrectionHistory[NO_PIECE][0];

Expand Down Expand Up @@ -891,6 +892,10 @@ Value Search::Worker::search(
ss->continuationCorrectionHistory =
&this->continuationCorrectionHistory[pos.moved_piece(move)][move.to_sq()];

ss->statScore = 2 * thisThread->mainHistory[us][move.from_to()]
+ (*(ss - 1)->continuationHistory)[movedPiece][move.to_sq()]
+ (*(ss - 2)->continuationHistory)[movedPiece][move.to_sq()] - 4410;

thisThread->nodes.fetch_add(1, std::memory_order_relaxed);
pos.do_move(move, st);

Expand Down

0 comments on commit 36ea174

Please sign in to comment.