Various cleanups

Various simplifications, cleanups, consistancy improvements, and warning
mitigations.

Passed Non-Regression STC:
https://tests.stockfishchess.org/tests/view/67e7dd2d6682f97da2178fd8
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 386848 W: 99593 L: 99751 D: 187504
Ptnml(0-2): 1024, 41822, 107973, 41498, 1107

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

No functional change
This commit is contained in:
mstembera
2025-04-02 17:43:14 +02:00
committed by Disservin
parent 1a395f1b56
commit ed89817f62
8 changed files with 33 additions and 41 deletions
+8 -9
View File
@@ -492,7 +492,8 @@ void Search::Worker::iterative_deepening() {
// Do we have time for the next iteration? Can we stop searching now?
if (limits.use_time_management() && !threads.stop && !mainThread->stopOnPonderhit)
{
int nodesEffort = rootMoves[0].effort * 100000 / std::max(size_t(1), size_t(nodes));
uint64_t nodesEffort =
rootMoves[0].effort * 100000 / std::max(size_t(1), size_t(nodes));
double fallingEval =
(11.396 + 2.035 * (mainThread->bestPreviousAverageScore - bestValue)
@@ -929,10 +930,7 @@ Value Search::Worker::search(
{
assert(move.is_ok());
if (move == excludedMove)
continue;
if (!pos.legal(move))
if (move == excludedMove || !pos.legal(move))
continue;
assert(pos.capture_stage(move));
@@ -1572,12 +1570,13 @@ Value Search::Worker::qsearch(Position& pos, Stack* ss, Value alpha, Value beta)
return ttData.value;
// Step 4. Static evaluation of the position
Value unadjustedStaticEval = VALUE_NONE;
const auto correctionValue = correction_value(*thisThread, pos, ss);
Value unadjustedStaticEval = VALUE_NONE;
if (ss->inCheck)
bestValue = futilityBase = -VALUE_INFINITE;
else
{
const auto correctionValue = correction_value(*thisThread, pos, ss);
if (ss->ttHit)
{
// Never assume anything about values stored in TT
@@ -1930,8 +1929,8 @@ Move Skill::pick_best(const RootMoves& rootMoves, size_t multiPV) {
for (size_t i = 0; i < multiPV; ++i)
{
// This is our magic formula
int push = (weakness * int(topScore - rootMoves[i].score)
+ delta * (rng.rand<unsigned>() % int(weakness)))
int push = int(weakness * int(topScore - rootMoves[i].score)
+ delta * (rng.rand<unsigned>() % int(weakness)))
/ 128;
if (rootMoves[i].score + push >= maxScore)