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.43k stars 531 forks source link

Remaining XBoard API #182

Closed Mk-Chan closed 5 years ago

Mk-Chan commented 7 years ago

I wanted to make a checklist of the remaining API (xboard commands). Sorry if this is a little large but it's taken directly from the spec. Xboard -> Engine commands:

Engine -> Xboard commands (Parsing required):

Mk-Chan commented 7 years ago

No wonder it's much easier to code UCI, this is quite a mess!

PedanticHacker commented 7 years ago

I looked into this and found out that it is an overkill to implement the whole XBoard specification in Python and support the old XBoard spec and the new spec. You must realize that XBoard only runs on *nix machines (Mac, Linux). You have to take Windows users into consideration, too. Well, then you need to implement the WinBoard specification as well. So much code!

My proposal is this. Since we have UCI specification fully implemented, we can just implement a UCI adapter. Take a look at this: http://wbec-ridderkerk.nl/html/details1/PolyGlot.html

niklasf commented 7 years ago

Sure, adapters are cool, and some already exist. But XBoard also has some features that UCI does not have, so I think a direct protocol implementation is good to have.

Mk-Chan commented 7 years ago

Interestingly enough, we were joking around in HG Muller's monthly tourney and he told me that uci engines can send xboard commands to the GUI via info string xboard <any xboard cmd>

Want to take a stab at it @niklasf ?

PedanticHacker commented 7 years ago

Interesting stuff! Is this ment for Winboard as well?

Mk-Chan commented 7 years ago

As I said before, Xboard and Winboard are the same thing. Winboard is simply the windows version of Xboard.

gbtami commented 7 years ago

@PedanticHacker xboard and winboard are chess GUI programs communicating with engines via CECP protocol.

Btw. there is a newer CECP document maintained by HGM here http://hgm.nubati.net/CECP.html It organized in a different way and contains some stuff not in the old one.

Mk-Chan commented 6 years ago

@gbtami there are some new options yea and it looks much better presented. Thanks for this.

Mk-Chan commented 6 years ago

So I've been getting quite busy and haven't really found the time to get to the two major features(non ics related): pondering and variants. I'll get to them soon but i just wanted to comment here as a reminder.

Ravenslofty commented 6 years ago

Something important that's forgotten here is the # command for debugging. python-chess tries to parse lines beginning with # when they should be ignored, which makes it choke on the debugging/statistics code in Dorpsgek.

gbtami commented 6 years ago

@ZirconiumX @Mk-Chan fixed it in python-chess right now.

Mk-Chan commented 6 years ago

As of #272 pondering is left

Mk-Chan commented 6 years ago

Pondering is handled by #277 but testing is remaining. The difficulties I faced have been mentioned at the bottom of that PR. So now that main commands for protover 2 should be handled completely.

niklasf commented 6 years ago

I couldn't find a good way to test this easier. I guess it's fine for now ... maybe we'll find something eventually.

niklasf commented 5 years ago

I think the remaining commands should only be implemented if specifically requested.

thomasahle commented 5 years ago

How is "Error (ERRORTYPE): COMMAND" handled? It seems that currently we just throw

<XBoardProtocol (pid=97059)>: Unexpected engine output: Error (ERRORTYPE): COMMAND

and crash. Maybe exiting quickly is the best option.

Mk-Chan commented 5 years ago

This API is deprecated in favor of the engine one. Are you using an older version of python-chess?