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.4k stars 526 forks source link

Send game result to engines #998

Closed MarkZH closed 1 year ago

MarkZH commented 1 year ago

When a game is done, this method can be called to inform the engine of the final moves and the result of the game.

XBoard engines receive the final move of the game followed by a message like, for example, result 1-0 {White mates}. The second field is one of 1-0, 0-1, 1/2-1/2, * to indicate white winning, black winning, draw, or an incomplete game. The message in curly braces is optional and meant for humans to read.

If this method is called on a UCI engine, nothing happens, as those engines do not expect any endgame messages.

MarkZH commented 1 year ago

On another note, the Github tests are failing because the link to stockfish no longer works. Stockfish 11 can only be downloaded from a dropbox folder, which I doubt would allow automated downloads for long. The new link to Stockfish 16 is: https://github.com/official-stockfish/Stockfish/releases/download/sf_16/stockfish-windows-x86-64-avx2.zip

Github also has a cache mechanism to store files between test runs to negate the need to redownload or recreate them. We've done this in lichess-bot with this commit.