Some questions about xboard interpreter

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Some questions about xboard interpreter

Post by Luis Babboni »

Hi, i´m testing how my basic engine Soberango deals with Arena via xboard and still have some "tilts".

I took information about xboard from here:
https://www.gnu.org/software/xboard/engine-intf.html

And it says:

"result RESULT {COMMENT}
After the end of each game, xboard will send you a result command..."

But its seems that if the engine checkmate the user, that´s not happens:
Image
This seems cause my engine could not use the command "result" for reset as I thought. It seems better to use the comand "new" for it.
I´m right or I´m making a missunderstood somewhere?

Another question:
It seems sometimes the GUI need to be listened by the engine even in the middle of its calculations.
How often do you use to check what GUI could say? (In fact I´m still do nto know how to do it without requiering an INPUT that necesary stop the calculation :oops: )

Thanks!
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Some questions about xboard interpreter

Post by Evert »

Luis Babboni wrote: This seems cause my engine could not use the command "result" for reset as I thought. It seems better to use the comand "new" for it.
I´m right or I´m making a missunderstood somewhere?
Of course you should start a new game after you receive a "new" command, that's after all what "new" is for.

The "result" command actually has limited use: it's useful if you want to do some sort of learning where you record the game and the result, otherwise I don't think it's particularly useful (someone correct me if I'm wrong).
It seems sometimes the GUI need to be listened by the engine even in the middle of its calculations.
How often do you use to check what GUI could say? (In fact I´m still do nto know how to do it without requiering an INPUT that necesary stop the calculation :oops: )
I think I do that every several-tens-of-thousands of nodes, but there is no portable way to test if there is input available. However, you can have a peek at, for instance, Crafty to see how to do this.

A cleaner solution is to run the engine from a separate thread and just have an input thread that blocks until it receives input, but that requires a slightly different design.

EDIT: You might find the following a more accessible guide to the CECP protocol: http://hgm.nubati.net/CECP.html
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: Some questions about xboard interpreter

Post by Luis Babboni »

Thanks Evert! :D
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: Some questions about xboard interpreter

Post by Luis Babboni »

Evert wrote: ...
It seems sometimes the GUI need to be listened by the engine even in the middle of its calculations.
How often do you use to check what GUI could say? (In fact I´m still do nto know how to do it without requiering an INPUT that necesary stop the calculation :oops: )
I think I do that every several-tens-of-thousands of nodes, but there is no portable way to test if there is input available. However, you can have a peek at, for instance, Crafty to see how to do this.

A cleaner solution is to run the engine from a separate thread and just have an input thread that blocks until it receives input, but that requires a slightly different design.
...
First problem with it! :?
My engine lost on time and there is no way that he knows it so Arena jsut show "engine already calculating" and launch the next game and gives error.
But seems is just cause how simply it is that even not have time controls.
I just need to make that the engine knows time.

... I hope the GUI allows engines to take some time to know they are out of time.
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Some questions about xboard interpreter

Post by hgm »

If you want the engine to ponder, it is important that it checks if there is input regularly during the pondering, because the opponent could move. On Windows you can use PeekNamedPipe for this. When it is its own turn it can afford to ignore all input. (The only adverse effect is that 'Move Now' would not work, and that the engine would not notice opponent resigns or draw offers before it moves.)

The engine is supposed to keep track of the time it has been thinking, and move when it has used up the time it could afford.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: Some questions about xboard interpreter

Post by Luis Babboni »

Thanks HG!
hgm wrote:If you want the engine to ponder, it is important that it checks if there is input regularly during the pondering, because the opponent could move. On Windows you can use PeekNamedPipe for this. When it is its own turn it can afford to ignore all input. (The only adverse effect is that 'Move Now' would not work, and that the engine would not notice opponent resigns or draw offers before it moves.)
Beyond my understanding for the moment, I made my engine in FreeBasic, what I found about that PeekNamedPipe is in C++ for now.... but actually I just want to make a working engine and now it seems just become unresponding only if forfait by time.
hgm wrote: The engine is supposed to keep track of the time it has been thinking, and move when it has used up the time it could afford.
OK! I´m trying this now then.
Not knowing how much time the engine need to calculate the next move, after each attempted move it testing if the time it have after the last "time" command is ended or not. If ended, interrupt its calculationg, reset al variables and return to Xboard subroutine to listen the GUI.

And in fact it doing. Before this time control is added to my engine, the engine attempts to do a new move after GUI saids its forfait by time and not now.
More than this, its respond to the ping command as it can be see in the image below (BTW, why is not this the first command GUI sends to engine to know if it is listening or not?)

But my question now is:

How the GUI knows that an engine is "already calculating"?
What is the meaning of "already calculating"?
As far as I could understood, my engine is listening to the GUI but no command but "computer" was sent from GUI to my engine after "ping" command that not was listened.

I´m pretty sure the time between "ping" and "already calculating" (0.072 secs) is enough to my engine to be listening again.

Image
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Some questions about xboard interpreter

Post by hgm »

I don't know anything about Arena except that people say it is buggy. This looks like one of these bugs.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: Some questions about xboard interpreter

Post by Luis Babboni »

Wich GUI do you use to test engines?
I do not like Arena neither, but I do nto know another GUI that shows the dialogue betwween the engine and the GUI.
User avatar
hgm
Posts: 28461
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Some questions about xboard interpreter

Post by hgm »

I use WinBoard. With the -debug option this writes the debug log on the file winboard.debug, and I just open that file in NotePad to see what happened.
User avatar
Luis Babboni
Posts: 464
Joined: Sat Feb 28, 2015 4:37 pm
Location: Argentina

Re: Some questions about xboard interpreter

Post by Luis Babboni »

hgm wrote:I use WinBoard. With the -debug option this writes the debug log on the file winboard.debug, and I just open that file in NotePad to see what happened.
OK!

I tried this after you say could be Arena´s bug and gives me invalid move near instantly not having this in Arena for more than 40 matches actually, except those after lost on time.
I need to study what happened.