PraxTube / chess-ai

A chess AI that uses alpha-beta to find the best move
MIT License
0 stars 1 forks source link

AI: Error on stalemate #28

Closed PraxTube closed 1 year ago

PraxTube commented 1 year ago

If a stalemate is encountered the AI just crashes. One way to handle this, is to check if a stalemate can be reached and if that's the case and the evaluation is in our favor (i.e. we are winning), then evaluate it negatively, else evaluate it positively.

PraxTube commented 1 year ago

Of course the stalemate should still be handled properly by the system.

PraxTube commented 1 year ago

This is still an issue! We get the error

line 26, in game_over
    raise ValueError("The board indicated that it's not checkmate!", board.fen())
ValueError: ("The board indicated that it's not checkmate!", '8/5Q1N/7k/B2p1p2/3P1P2/8/PP2P1PP/3RKB1R b K - 0 1')