Skip to content

Commit a41c3c8

Browse files
committed
Do not eagerly check syzygy max pieces (fixes #1093)
1 parent 3829d26 commit a41c3c8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

chess/syzygy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,8 @@ def probe_wdl_table(self, board: chess.Board) -> int:
15461546
try:
15471547
table = typing.cast(WdlTable, self.wdl[key])
15481548
except KeyError:
1549+
if chess.popcount(board.occupied) > TBPIECES:
1550+
raise KeyError(f"syzygy tables support up to {TBPIECES} pieces, not {chess.popcount(board.occupied)}: {board.fen()}")
15491551
raise MissingTableError(f"did not find wdl table {key}")
15501552

15511553
self._bump_lru(table)
@@ -1558,8 +1560,6 @@ def probe_ab(self, board: chess.Board, alpha: int, beta: int, threats: bool = Fa
15581560
raise KeyError(f"tablebase has been opened for {self.variant.uci_variant}, probed with: {board.uci_variant}")
15591561
if board.castling_rights:
15601562
raise KeyError(f"syzygy tables do not contain positions with castling rights: {board.fen()}")
1561-
if chess.popcount(board.occupied) > TBPIECES:
1562-
raise KeyError(f"syzygy tables support up to {TBPIECES} pieces, not {chess.popcount(board.occupied)}: {board.fen()}")
15631563

15641564
# Special case: Variant with compulsory captures.
15651565
if self.variant.captures_compulsory:

0 commit comments

Comments
 (0)