1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-12 03:59:15 +00:00

Simplify condition in step 15

Remove 'ttValue <= alpha' check for negative extension in singular search.
Also apply some small code style changes.

STC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 127888 W: 33766 L: 33651 D: 60471
Ptnml(0-2): 303, 14082, 35089, 14137, 333
https://tests.stockfishchess.org/tests/view/63f79528e74a12625bcd8c05

LTC:
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 89048 W: 23924 L: 23782 D: 41342
Ptnml(0-2): 27, 8635, 27065, 8763, 34
https://tests.stockfishchess.org/tests/view/63f82177e74a12625bcda6f4

LTC (retest):
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 196360 W: 52514 L: 52475 D: 91371
Ptnml(0-2): 103, 19066, 59780, 19151, 80
https://tests.stockfishchess.org/tests/view/63f934bfe74a12625bcdd929

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

Bench: 5310866
This commit is contained in:
Alfredo Menezes 2023-02-27 00:39:26 -03:00 committed by Joost VandeVondele
parent 472e726bff
commit 98dafda6c8

View file

@ -432,7 +432,8 @@ void Thread::search() {
if (!Threads.stop) if (!Threads.stop)
completedDepth = rootDepth; completedDepth = rootDepth;
if (rootMoves[0].pv[0] != lastBestMove) { if (rootMoves[0].pv[0] != lastBestMove)
{
lastBestMove = rootMoves[0].pv[0]; lastBestMove = rootMoves[0].pv[0];
lastBestMoveDepth = rootDepth; lastBestMoveDepth = rootDepth;
} }
@ -729,7 +730,8 @@ namespace {
complexity = 0; complexity = 0;
goto moves_loop; goto moves_loop;
} }
else if (excludedMove) { else if (excludedMove)
{
// Providing the hint that this node's accumulator will be used often brings significant Elo gain (13 elo) // Providing the hint that this node's accumulator will be used often brings significant Elo gain (13 elo)
Eval::NNUE::hint_common_parent_position(pos); Eval::NNUE::hint_common_parent_position(pos);
eval = ss->staticEval; eval = ss->staticEval;
@ -755,6 +757,7 @@ namespace {
// Save static evaluation into transposition table // Save static evaluation into transposition table
tte->save(posKey, VALUE_NONE, ss->ttPv, BOUND_NONE, DEPTH_NONE, MOVE_NONE, eval); tte->save(posKey, VALUE_NONE, ss->ttPv, BOUND_NONE, DEPTH_NONE, MOVE_NONE, eval);
} }
thisThread->complexityAverage.update(complexity); thisThread->complexityAverage.update(complexity);
// Use static evaluation difference to improve quiet move ordering (~4 Elo) // Use static evaluation difference to improve quiet move ordering (~4 Elo)
@ -920,11 +923,9 @@ moves_loop: // When in check, search starts here
&& tte->depth() >= depth - 3 && tte->depth() >= depth - 3
&& ttValue >= probCutBeta && ttValue >= probCutBeta
&& abs(ttValue) <= VALUE_KNOWN_WIN && abs(ttValue) <= VALUE_KNOWN_WIN
&& abs(beta) <= VALUE_KNOWN_WIN && abs(beta) <= VALUE_KNOWN_WIN)
)
return probCutBeta; return probCutBeta;
const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory,
nullptr , (ss-4)->continuationHistory, nullptr , (ss-4)->continuationHistory,
nullptr , (ss-6)->continuationHistory }; nullptr , (ss-6)->continuationHistory };
@ -1099,8 +1100,8 @@ moves_loop: // When in check, search starts here
else if (ttValue >= beta) else if (ttValue >= beta)
extension = -2; extension = -2;
// If the eval of ttMove is less than alpha and value, we reduce it (negative extension) // If the eval of ttMove is less than value, we reduce it (negative extension)
else if (ttValue <= alpha && ttValue <= value) else if (ttValue <= value)
extension = -1; extension = -1;
} }
@ -1271,14 +1272,17 @@ moves_loop: // When in check, search starts here
rm.selDepth = thisThread->selDepth; rm.selDepth = thisThread->selDepth;
rm.scoreLowerbound = rm.scoreUpperbound = false; rm.scoreLowerbound = rm.scoreUpperbound = false;
if (value >= beta) { if (value >= beta)
{
rm.scoreLowerbound = true; rm.scoreLowerbound = true;
rm.uciScore = beta; rm.uciScore = beta;
} }
else if (value <= alpha) { else if (value <= alpha)
{
rm.scoreUpperbound = true; rm.scoreUpperbound = true;
rm.uciScore = alpha; rm.uciScore = alpha;
} }
rm.pv.resize(1); rm.pv.resize(1);
assert((ss+1)->pv); assert((ss+1)->pv);
@ -1448,6 +1452,7 @@ moves_loop: // When in check, search starts here
// only two types of depth in TT: DEPTH_QS_CHECKS or DEPTH_QS_NO_CHECKS. // only two types of depth in TT: DEPTH_QS_CHECKS or DEPTH_QS_NO_CHECKS.
ttDepth = ss->inCheck || depth >= DEPTH_QS_CHECKS ? DEPTH_QS_CHECKS ttDepth = ss->inCheck || depth >= DEPTH_QS_CHECKS ? DEPTH_QS_CHECKS
: DEPTH_QS_NO_CHECKS; : DEPTH_QS_NO_CHECKS;
// Step 3. Transposition table lookup // Step 3. Transposition table lookup
posKey = pos.key(); posKey = pos.key();
tte = TT.probe(posKey, ss->ttHit); tte = TT.probe(posKey, ss->ttHit);
@ -1577,7 +1582,6 @@ moves_loop: // When in check, search starts here
// Do not search moves with bad enough SEE values (~5 Elo) // Do not search moves with bad enough SEE values (~5 Elo)
if (!pos.see_ge(move, Value(-110))) if (!pos.see_ge(move, Value(-110)))
continue; continue;
} }
// Speculative prefetch as early as possible // Speculative prefetch as early as possible