Feedback request: libchessinterface

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

JonasThiem
Posts: 36
Joined: Sun Sep 02, 2012 5:23 pm

Re: Feedback request: libchessinterface

Post by JonasThiem »

Would you mind to explain what you mean by 3 time controls? Is it not what void chessinterface_SetTimeControl(struct chessinterfaceengine* engine,
int timeInSeconds, int movesUntilIncrease, int increasePerMoveSeconds);
does? ("level" command in CECP/Winboard)
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: Feedback request: libchessinterface

Post by diep »

JonasThiem wrote:Would you mind to explain what you mean by 3 time controls? Is it not what void chessinterface_SetTimeControl(struct chessinterfaceengine* engine,
int timeInSeconds, int movesUntilIncrease, int increasePerMoveSeconds);
does? ("level" command in CECP/Winboard)
No.

My question to you: Have you ever looked at how C++ GUI's function at codeside? Or written a plugin for existing GUI's?

Say Adobe or something?

You can download that SDK real cheap.
JonasThiem
Posts: 36
Joined: Sun Sep 02, 2012 5:23 pm

Re: Feedback request: libchessinterface

Post by JonasThiem »

Have you ever seen how a C gui works?

I don't think a C++ programmer would have trouble wrapping my API suggestion into a nice class. If you have improvement suggestions, I'd love to hear them (but you seem to be a bit reluctant to tell me things, e.g. what is it with that 3 clock time control?).
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: Feedback request: libchessinterface

Post by diep »

JonasThiem wrote:Have you ever seen how a C gui works?

I don't think a C++ programmer would have trouble wrapping my API suggestion into a nice class. If you have improvement suggestions, I'd love to hear them (but you seem to be a bit reluctant to tell me things, e.g. what is it with that 3 clock time control?).
If they already build a class, no need to use your code, as every line needs to get rewritten anyway.

You get the picture?

p.s. every FIDE time control is either 2 or 3 time controls.
My engine likes to know in advance all time controls prior to dividing time.
Michel
Posts: 2273
Joined: Mon Sep 29, 2008 1:50 am

Re: Feedback request: libchessinterface

Post by Michel »

I'm planning to write a C/C++ engine handling library and would like to hear some comments on its usefulness and the interface.
The idea is of course attractive and logical. Unfortunately using shared libraries is not popular with chess engine authors. They prefer to include the code directly into their programs.

For example the Gaviota table base code is perfectly compilable as a shared library. Yet it is not used that way.

I must say that there is one exception, namely the Scorpio bitbases. These are typically accessed through a dll.
JonasThiem
Posts: 36
Joined: Sun Sep 02, 2012 5:23 pm

Re: Feedback request: libchessinterface

Post by JonasThiem »

To be clear, the library is purely for GUIs. It is supposed to allow a GUI to use UCI/Winboard/CECP engines all at once without writing much code, and without rewriting all the "launch program, build up pipes to it and then read the pipes in separate thread and parse all protocol commands" work. I saw GUIs often lacked some protocol features or just implemented one protocol, and I hoped such a library would solve this.
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: Feedback request: libchessinterface

Post by diep »

JonasThiem wrote:To be clear, the library is purely for GUIs. It is supposed to allow a GUI to use UCI/Winboard/CECP engines all at once without writing much code, and without rewriting all the "launch program, build up pipes to it and then read the pipes in separate thread and parse all protocol commands" work. I saw GUIs often lacked some protocol features or just implemented one protocol, and I hoped such a library would solve this.
Can you give example of popular GUI's that lack features or protocols in your viewpoint?
User avatar
hgm
Posts: 27855
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Feedback request: libchessinterface

Post by hgm »

I won't be as unfriendly as Vincent, but I must say that I have my doubts about the usefulness of a project like this. The reason is that the library is just another implementation of what is basically the same interface. To control a Chess engine you need some elementary commands (start and stop the search, enter moves, load positions, alter settings, specify thinking time, ...) It makes awfully little difference to the user whether you realize these basic commands through calling a C++ function (e.g. StartPlaying(engine1); ) or by sending a text string (fprintf(engine1, "go\n"); )

In fact one can argue that the text interface is more general, and hence superior to the DLL interface. Any program can print text. DLLs, OTOH, are platform dependent, language dependent, and as a rule a pain to use. Unless the DLL does something truly complex, it would be the inferior solution. And you already remarked yourself that what you get is rather reminiscent of WB protocol, i.e. close to a simple 1:1 mapping, and not a complex transformation. I think the original designers of these protocols made a very wise choice when they implemented them as text sent through pipes, rather than calling routines in DLLs (as the ChessBase and TMCI protocols do).

So my preference has always gone out to use the (more powerful) WB protocol as the basic interface level, rather than a set of DLL entry points, and use that as a basis for implementing other protocols (like in UCI2WB, Smirfoglot, Max2WB etc.). Much more convenient as starting with a DLL, as the resulting protocol adapters are more generally useful.

A library to spawn a process connected to pipes could have some use. OTOH, I am not sure that this is worth it, as it is not too difficult (similar in complexity to intefacing with the DLL...)
diep
Posts: 1822
Joined: Thu Mar 09, 2006 11:54 pm
Location: The Netherlands

Re: Feedback request: libchessinterface

Post by diep »

...DLL...
that's a windoze only thing.

..
A library to spawn a process connected to pipes could have some use. OTOH, I am not sure that this is worth it, as it is not too difficult (similar in complexity to intefacing with the DLL...)
Not in C++, all the C++ libraries implement this in a different manner. You don't want a piece of code that changes the way how your library implements such communication as that garantueed will give problems.

p.s. i suspect future GUI's mostly will be in Java so we are speaking about what exactly?
JonasThiem
Posts: 36
Joined: Sun Sep 02, 2012 5:23 pm

Re: Feedback request: libchessinterface

Post by JonasThiem »

In particular, PyChess lacked a proper CECPv2 feature implementation for quite some time. It also didn't support rather simple features like colors=0 or debug=1. For UCI, it still gives a FEN for each position instead of startpos + all moves leading up to it which would allow the engine to evaluate 3-fold repetition and other things properly.

I think older Arena versions (<=2) also just accepted features and never rejected any (it just ignored those it didn't know).

XBoard/WinBoard seem pretty awesome with CECP (naturally), but the UCI seems to be a bit hackish with polyglot (although I don't know enough about polyglot to really confirm that). Or UCI2WB as HGM mentioned in the other post, but that works in a similar way I suppose?
Last edited by JonasThiem on Wed Oct 31, 2012 4:36 pm, edited 1 time in total.