thomasahle/sunfish

Illegal moves when death is imminent

Closed this issue · 6 comments

Just played a game against it on my local IDE. Towards the end of the game, the king captures my knight which is already defended by the queen, moving into check. It then allowed me to capture its King with my Queen.

Here's the game log: https://paste.ubuntu.com/p/7q6Jb92Cht/

Was sunfish in checkmate when it played against the rules? Or was there simply a checkmate within reach of a few plies?

I've attached the game, around line 1653, you'll see that the king captures the knight that is defended by the queen. Thereby moving into check.

I found another example of sunfish making illegal moves when losing. This time during an xboard game:

$ python -u xboard.py                    
setboard 3Q4/8/2Q2P2/6P1/6K1/3k4/8/8 b - - 3 55
go
move d3e2

Pretty bad.

I observed the same thing when playing it in this short game: https://pastebin.com/LEs7sxrw

For xboard sunfish now correctly calls "resign" rather the keeping on playing.
When playing directly with sunfish.py, the king will still be sacrificed the way you show. I guess we can take it as sunfish's way of "handing over the king" :)

The latest version now plays correctly in positions like 3Q4/8/2Q2P2/6P1/6K1/3k4/8/8 b - - 3 55.