Just downloaded the Python-Chess module and wanted to test it out; whenever I check the board state by using board.is_checkmate
, board.is_stalemate
, board.is_check
, board.is_en_passant
and a print statement, it always returns true.
I'm using VSCode on macOS 11.3. Python version is 3.8.2.
import chess
board = chess.Board()
if board.is_checkmate:
print("game over")
You are checking if a method exists. You need to call the method and check what is returned. Adding brackets will complete this. This will call the method, which checks if the board is in this state.
You can test this by printing "board.is_checkmate()" vs "board.is_checkmate" one will give true / false the other an address in memory that that method is stored.