Simplify handling of good/bad quiets

Simplify the handling of good/bad quiets and make it more similar to the way we
handle good/bad captures. The good quiet limit was adjusted from -7998 to
-14000 to keep the ratio of good/bad quiets about the same as master.  This
also fixes a "bug" that previously returned some bad quiets during the
GOOD_QUIET stage when some qood quiets weren't sorted at low depths.

STC https://tests.stockfishchess.org/tests/view/6827a68c6ec7634154f9992b
LLR: 2.93 (-2.94,2.94) <-1.75,0.25>
Total: 75936 W: 19722 L: 19547 D: 36667
Ptnml(0-2): 186, 8937, 19589, 9028, 228

LTC https://tests.stockfishchess.org/tests/view/6828f8096ec7634154f99b82
LLR: 2.94 (-2.94,2.94) <-1.75,0.25>
Total: 104112 W: 26773 L: 26638 D: 50701
Ptnml(0-2): 51, 11363, 29098, 11488, 56

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

Bench: 2007023
This commit is contained in:
mstembera
2025-05-16 13:04:10 -07:00
committed by Joost VandeVondele
parent 39942db3ff
commit 009632c465
2 changed files with 10 additions and 14 deletions

View File

@@ -208,8 +208,6 @@ Move MovePicker::select(Pred filter) {
// picking the move with the highest score from a list of generated moves.
Move MovePicker::next_move() {
auto quiet_threshold = [](Depth d) { return -3560 * d; };
top:
switch (stage)
{
@@ -250,24 +248,22 @@ top:
case QUIET_INIT :
if (!skipQuiets)
{
endMoves = beginBadQuiets = endBadQuiets = generate<QUIETS>(pos, cur);
cur = endBadQuiets = endBadCaptures;
endMoves = generate<QUIETS>(pos, cur);
score<QUIETS>();
partial_insertion_sort(cur, endMoves, quiet_threshold(depth));
partial_insertion_sort(cur, endMoves, -3560 * depth);
}
++stage;
[[fallthrough]];
case GOOD_QUIET :
if (!skipQuiets && select([]() { return true; }))
{
if ((cur - 1)->value > -7998 || (cur - 1)->value <= quiet_threshold(depth))
return *(cur - 1);
// Remaining quiets are bad
beginBadQuiets = cur - 1;
}
if (!skipQuiets && select([&]() {
return cur->value > -14000 ? true
: (*endBadQuiets++ = *cur, false);
}))
return *(cur - 1);
// Prepare the pointers to loop over the bad captures
cur = moves;
@@ -281,7 +277,7 @@ top:
return *(cur - 1);
// Prepare the pointers to loop over the bad quiets
cur = beginBadQuiets;
cur = endBadCaptures;
endMoves = endBadQuiets;
++stage;

View File

@@ -68,7 +68,7 @@ class MovePicker {
const PieceToHistory** continuationHistory;
const PawnHistory* pawnHistory;
Move ttMove;
ExtMove * cur, *endMoves, *endBadCaptures, *beginBadQuiets, *endBadQuiets;
ExtMove * cur, *endMoves, *endBadCaptures, *endBadQuiets;
int stage;
int threshold;
Depth depth;