Unify do_move & do_null_move workload

While being there also remove and unused assignment.

Tested for non-regression at STC:
https://tests.stockfishchess.org/tests/view/69060d81ea4b268f1fac1f36
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 94496 W: 24570 L: 24421 D: 45505
Ptnml(0-2): 264, 10145, 26275, 10306, 258

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

no functional change
This commit is contained in:
Guenther Demetz
2025-11-13 22:26:35 +01:00
committed by Joost VandeVondele
parent 84148586e5
commit 4784ff2b3b
2 changed files with 9 additions and 10 deletions
+8 -9
View File
@@ -544,7 +544,12 @@ void Search::Worker::do_move(
}
}
void Search::Worker::do_null_move(Position& pos, StateInfo& st) { pos.do_null_move(st, tt); }
void Search::Worker::do_null_move(Position& pos, StateInfo& st, Stack* const ss) {
pos.do_null_move(st, tt);
ss->currentMove = Move::null();
ss->continuationHistory = &continuationHistory[0][0][NO_PIECE][0];
ss->continuationCorrectionHistory = &continuationCorrectionHistory[NO_PIECE][0];
}
void Search::Worker::undo_move(Position& pos, const Move move) {
pos.undo_move(move);
@@ -868,12 +873,7 @@ Value Search::Worker::search(
// Null move dynamic reduction based on depth
Depth R = 6 + depth / 3 + improving;
ss->currentMove = Move::null();
ss->continuationHistory = &continuationHistory[0][0][NO_PIECE][0];
ss->continuationCorrectionHistory = &continuationCorrectionHistory[NO_PIECE][0];
do_null_move(pos, st);
do_null_move(pos, st, ss);
Value nullValue = -search<NonPV>(pos, ss + 1, -beta, -beta + 1, depth - R, false);
@@ -1580,8 +1580,7 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta)
futilityBase = ss->staticEval + 352;
}
const PieceToHistory* contHist[] = {(ss - 1)->continuationHistory,
(ss - 2)->continuationHistory};
const PieceToHistory* contHist[] = {(ss - 1)->continuationHistory};
Square prevSq = ((ss - 1)->currentMove).is_ok() ? ((ss - 1)->currentMove).to_sq() : SQ_NONE;