Skip to content

Commit 85f8764

Browse files
xu-shawnvondele
authored andcommitted
Simplify stalemate detection
Passed Non-regression STC: LLR: 2.96 (-2.94,2.94) <-1.75,0.25> Total: 107392 W: 27959 L: 27818 D: 51615 Ptnml(0-2): 317, 12094, 28735, 12231, 319 https://tests.stockfishchess.org/tests/view/68a65d8ab6fb3300203bc825 Passed Non-regression LTC: LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 94014 W: 24129 L: 23986 D: 45899 Ptnml(0-2): 47, 9917, 26934, 10064, 45 https://tests.stockfishchess.org/tests/view/68a8f45cb6fb3300203bcb5e Passed Stalemate 10k: Elo: 2.22 ± 1.3 (95%) LOS: 100.0% Total: 10000 W: 4626 L: 4562 D: 812 Ptnml(0-2): 1, 137, 4659, 203, 0 nElo: 12.00 ± 6.8 (95%) PairsRatio: 1.47 https://tests.stockfishchess.org/tests/view/68a65d8ab6fb3300203bc825 Supersedes official-stockfish#6114 Closes official-stockfish#6232 closes official-stockfish#6255 Bench: 2473929
1 parent 7fa7a36 commit 85f8764

File tree

3 files changed

+1
-22
lines changed

3 files changed

+1
-22
lines changed

src/movepick.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -316,23 +316,4 @@ Move MovePicker::next_move() {
316316

317317
void MovePicker::skip_quiet_moves() { skipQuiets = true; }
318318

319-
// this function must be called after all quiet moves and captures have been generated
320-
bool MovePicker::can_move_king_or_pawn() const {
321-
322-
assert((GOOD_QUIET <= stage && stage <= BAD_QUIET) || stage == EVASION);
323-
324-
// Until good capture state no quiet moves are generated for comparison so simply assume king or pawns can move.
325-
// Do the same for other states that don't have a valid available move list.
326-
if ((GOOD_QUIET > stage || stage > BAD_QUIET) && stage != EVASION)
327-
return true;
328-
329-
for (const ExtMove* m = moves; m < endGenerated; ++m)
330-
{
331-
PieceType movedPieceType = type_of(pos.moved_piece(*m));
332-
if ((movedPieceType == PAWN || movedPieceType == KING) && pos.legal(*m))
333-
return true;
334-
}
335-
return false;
336-
}
337-
338319
} // namespace Stockfish

src/movepick.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ class MovePicker {
5050
MovePicker(const Position&, Move, int, const CapturePieceToHistory*);
5151
Move next_move();
5252
void skip_quiet_moves();
53-
bool can_move_king_or_pawn() const;
5453

5554
private:
5655
template<typename Pred>

src/search.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,7 @@ Value Search::Worker::search(
10561056
depth > 2 && alpha < 0 && pos.non_pawn_material(us) == PieceValue[movedPiece]
10571057
&& PieceValue[movedPiece] >= RookValue
10581058
// it can't be stalemate if we moved a piece adjacent to the king
1059-
&& !(attacks_bb<KING>(pos.square<KING>(us)) & move.from_sq())
1060-
&& !mp.can_move_king_or_pawn();
1059+
&& !(attacks_bb<KING>(pos.square<KING>(us)) & move.from_sq());
10611060

10621061
// avoid pruning sacrifices of our last piece for stalemate
10631062
if (!mayStalemateTrap)

0 commit comments

Comments
 (0)