mirror of
https://github.com/official-stockfish/Stockfish.git
synced 2026-07-23 05:07:14 +00:00
Preserve all moves in movepicker
Simplifies method otherPieceTypesMobile quite a bit and makes it more precise. More precise because capturesSearched list not always contains all processed captures: although extremely rare, it can happen that a 'good' capture get pruned at step 14 and doesn't make it to capturesSearched. (functional change at higher depths) passed STC-simplification bounds https://tests.stockfishchess.org/tests/view/68025974cd501869c6698153 LLR: 2.93 (-2.94,2.94) <-1.75,0.25> Total: 273664 W: 15658 L: 15681 D: 242325 Ptnml(0-2): 166, 10368, 115802, 10315, 181 passed LTC-simplification bounds https://tests.stockfishchess.org/tests/view/6804b86acd501869c6698673 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 96780 W: 24547 L: 24419 D: 47814 Ptnml(0-2): 30, 8466, 31286, 8562, 46 Applied changes requested by disservin & retested to be on the safe side STC: https://tests.stockfishchess.org/tests/view/6806110698cd372e3aea5919 LLR: 2.95 (-2.94,2.94) <-1.75,0.25> Total: 107392 W: 27739 L: 27606 D: 52047 Ptnml(0-2): 266, 10867, 31306, 10982, 275 LTC: https://tests.stockfishchess.org/tests/view/6806346198cd372e3aea5965 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 233484 W: 59106 L: 59103 D: 115275 Ptnml(0-2): 116, 22787, 70939, 22778, 122 closes https://github.com/official-stockfish/Stockfish/pull/6005 Bench: 1857323
This commit is contained in:
+19
-23
@@ -19,8 +19,8 @@
|
||||
#include "movepick.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "bitboard.h"
|
||||
#include "misc.h"
|
||||
@@ -223,6 +223,7 @@ top:
|
||||
case QSEARCH_TT :
|
||||
case PROBCUT_TT :
|
||||
++stage;
|
||||
cur = moves + 1;
|
||||
return ttMove;
|
||||
|
||||
case CAPTURE_INIT :
|
||||
@@ -238,9 +239,12 @@ top:
|
||||
|
||||
case GOOD_CAPTURE :
|
||||
if (select([&]() {
|
||||
// Move losing capture to endBadCaptures to be tried later
|
||||
return pos.see_ge(*cur, -cur->value / 18) ? true
|
||||
: (*endBadCaptures++ = *cur, false);
|
||||
if (!pos.see_ge(*cur, -cur->value / 18))
|
||||
{
|
||||
std::swap(*endBadCaptures++, *cur);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}))
|
||||
return *(cur - 1);
|
||||
|
||||
@@ -250,7 +254,6 @@ top:
|
||||
case QUIET_INIT :
|
||||
if (!skipQuiets)
|
||||
{
|
||||
cur = endBadCaptures;
|
||||
endMoves = beginBadQuiets = endBadQuiets = generate<QUIETS>(pos, cur);
|
||||
|
||||
score<QUIETS>();
|
||||
@@ -317,30 +320,23 @@ top:
|
||||
|
||||
void MovePicker::skip_quiet_moves() { skipQuiets = true; }
|
||||
|
||||
bool MovePicker::otherPieceTypesMobile(PieceType pt, ValueList<Move, 32>& capturesSearched) {
|
||||
if (stage != GOOD_QUIET && stage != BAD_QUIET)
|
||||
return true;
|
||||
bool MovePicker::other_piece_types_mobile(PieceType pt) {
|
||||
assert(stage == GOOD_QUIET || stage == BAD_QUIET || stage == EVASION);
|
||||
|
||||
// verify good captures
|
||||
for (std::size_t i = 0; i < capturesSearched.size(); i++)
|
||||
if (type_of(pos.moved_piece(capturesSearched[i])) != pt)
|
||||
// verify all generated captures and quiets
|
||||
for (ExtMove* m = moves; m < endMoves; ++m)
|
||||
{
|
||||
if (*m && type_of(pos.moved_piece(*m)) != pt)
|
||||
{
|
||||
if (type_of(pos.moved_piece(capturesSearched[i])) != KING)
|
||||
if (type_of(pos.moved_piece(*m)) != KING)
|
||||
return true;
|
||||
if (pos.legal(capturesSearched[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
// now verify bad captures and quiets
|
||||
for (ExtMove* c = moves; c < endBadQuiets; ++c)
|
||||
if (type_of(pos.moved_piece(*c)) != pt)
|
||||
{
|
||||
if (type_of(pos.moved_piece(*c)) != KING)
|
||||
return true;
|
||||
if (pos.legal(*c))
|
||||
if (pos.legal(*m))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MovePicker::mark_current_illegal() { *(cur - 1) = Move::none(); }
|
||||
|
||||
} // namespace Stockfish
|
||||
|
||||
Reference in New Issue
Block a user