mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Remove moveCountPruning in search.cpp
The definition of moveCountPruning may cause confusion by implying that the variable is unconstrained. However, once it is set to true, it should not be reset to false, otherwise it would break the internal logic of MovePicker. Several patches have overlooked this constraint. For example: https://tests.stockfishchess.org/tests/view/671e7c0486d5ee47d953d226 https://tests.stockfishchess.org/tests/view/66a1de7b4ff211be9d4eccea The implementation approach was suggested by Disservin. Passed non-regression STC: LLR: 3.02 (-2.94,2.94) <-1.75,0.25> Total: 180672 W: 47072 L: 47006 D: 86594 Ptnml(0-2): 536, 19482, 50247, 19522, 549 https://tests.stockfishchess.org/tests/view/6720df6f86d5ee47d953d542 closes https://github.com/official-stockfish/Stockfish/pull/5661 No functional change
This commit is contained in:
parent
8681d3c2b3
commit
24c57793e1
3 changed files with 10 additions and 6 deletions
|
@ -216,7 +216,7 @@ Move MovePicker::select(Pred filter) {
|
||||||
// This is the most important method of the MovePicker class. We emit one
|
// This is the most important method of the MovePicker class. We emit one
|
||||||
// new pseudo-legal move on every call until there are no more moves left,
|
// new pseudo-legal move on every call until there are no more moves left,
|
||||||
// picking the move with the highest score from a list of generated moves.
|
// picking the move with the highest score from a list of generated moves.
|
||||||
Move MovePicker::next_move(bool skipQuiets) {
|
Move MovePicker::next_move() {
|
||||||
|
|
||||||
auto quiet_threshold = [](Depth d) { return -3560 * d; };
|
auto quiet_threshold = [](Depth d) { return -3560 * d; };
|
||||||
|
|
||||||
|
@ -322,4 +322,6 @@ top:
|
||||||
return Move::none(); // Silence warning
|
return Move::none(); // Silence warning
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MovePicker::skip_quiet_moves() { skipQuiets = true; }
|
||||||
|
|
||||||
} // namespace Stockfish
|
} // namespace Stockfish
|
||||||
|
|
|
@ -212,7 +212,8 @@ class MovePicker {
|
||||||
const PawnHistory*,
|
const PawnHistory*,
|
||||||
int);
|
int);
|
||||||
MovePicker(const Position&, Move, int, const CapturePieceToHistory*);
|
MovePicker(const Position&, Move, int, const CapturePieceToHistory*);
|
||||||
Move next_move(bool skipQuiets = false);
|
Move next_move();
|
||||||
|
void skip_quiet_moves();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template<PickType T, typename Pred>
|
template<PickType T, typename Pred>
|
||||||
|
@ -234,6 +235,7 @@ class MovePicker {
|
||||||
int threshold;
|
int threshold;
|
||||||
Depth depth;
|
Depth depth;
|
||||||
int ply;
|
int ply;
|
||||||
|
bool skipQuiets = false;
|
||||||
ExtMove moves[MAX_MOVES];
|
ExtMove moves[MAX_MOVES];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -942,12 +942,11 @@ moves_loop: // When in check, search starts here
|
||||||
|
|
||||||
value = bestValue;
|
value = bestValue;
|
||||||
|
|
||||||
int moveCount = 0;
|
int moveCount = 0;
|
||||||
bool moveCountPruning = false;
|
|
||||||
|
|
||||||
// Step 13. Loop through all pseudo-legal moves until no moves remain
|
// Step 13. Loop through all pseudo-legal moves until no moves remain
|
||||||
// or a beta cutoff occurs.
|
// or a beta cutoff occurs.
|
||||||
while ((move = mp.next_move(moveCountPruning)) != Move::none())
|
while ((move = mp.next_move()) != Move::none())
|
||||||
{
|
{
|
||||||
assert(move.is_ok());
|
assert(move.is_ok());
|
||||||
|
|
||||||
|
@ -993,7 +992,8 @@ moves_loop: // When in check, search starts here
|
||||||
if (!rootNode && pos.non_pawn_material(us) && bestValue > VALUE_TB_LOSS_IN_MAX_PLY)
|
if (!rootNode && pos.non_pawn_material(us) && bestValue > VALUE_TB_LOSS_IN_MAX_PLY)
|
||||||
{
|
{
|
||||||
// Skip quiet moves if movecount exceeds our FutilityMoveCount threshold (~8 Elo)
|
// Skip quiet moves if movecount exceeds our FutilityMoveCount threshold (~8 Elo)
|
||||||
moveCountPruning = moveCount >= futility_move_count(improving, depth);
|
if (moveCount >= futility_move_count(improving, depth))
|
||||||
|
mp.skip_quiet_moves();
|
||||||
|
|
||||||
// Reduced depth of the next LMR search
|
// Reduced depth of the next LMR search
|
||||||
int lmrDepth = newDepth - r;
|
int lmrDepth = newDepth - r;
|
||||||
|
|
Loading…
Add table
Reference in a new issue