niklasf / python-chess

A chess library for Python, with move generation and validation, PGN parsing and writing, Polyglot opening book reading, Gaviota tablebase probing, Syzygy tablebase probing, and UCI/XBoard engine communication
https://python-chess.readthedocs.io/en/latest/
GNU General Public License v3.0
2.45k stars 531 forks source link

is_variant_draw seems not to work properly #1056

Closed Corallo closed 10 months ago

Corallo commented 10 months ago

I might be misunderstanding the meaning of the function is_variant_draw, but if it is supposed to return "True" in case of any draw, it doesn't seem to work.

Here's a way to reproduce it

move_str ="Nc3 d5 Nf3 b6 Nd4 Bd7 Nxd5 Nh6 Rb1 f6 Ra1 Qc8 Rb1 g5 d3 Nf5 Nxf5 Bxf5 e4 Bg6 Qf3 Kf7 Bxg5 c5 Be2 Nc6 O-O c4 dxc4 b5 cxb5 Nd4 Qd3 Nxe2+ Qxe2 Rb8 Bf4 Rb7 Kh1 Rxb5 Qxb5 Bxe4 Rbc1 Bxg2+ Kxg2 Qg4+ Bg3 Qe4+ f3 Qg6 Qb8 f5 Nf4 Qb6 Qa8 Bh6 Qxh8 Bg7 Qxh7 a6 Rb1 e5 Nd5 Qg6 Qxg6+ Kxg6 Rf2 Kf7 Kh1 Bf6 Nxf6 Kxf6 Ra1 Kg7 Bxe5+ Kg8 Rg1+ Kf8 Rg5 Ke7 Rxf5 Ke8 Rf6 a5 Ra6 Kf7 Ra8 Ke6 Rxa5 Ke7 Ra8 Ke6 Re2 Kf5 Ra6 Kg5 Rd6 Kh4 Rf2 Kg5 Re2 Kh4 Rf2 Kg5 Re2"
 board = chess.Board()
        for move in self.move_str.split(" "):
            if move != "":
                board.push_san(move)
print(board.is_variant_draw())

I would be happy to look into the issue if you confirm this is not an intended behavior

niklasf commented 10 months ago

board.is_variant_draw() is intended to only detect variant-specific end conditions, for example white and black kings both reaching the backrank in Racing Kings.