Polyglot & kibitz

Discussions about Winboard/Xboard. News about engines or programs to use with these GUIs (e.g. tournament managers or adapters) belong in this sub forum.

Moderator: Andres Valverde

Polyglot & kibitz

Postby Stefan Knappe » 08 Feb 2005, 22:36

Hi,

I'd like to participate with my engine (UCI) in the next CCT. Based on some reasons I would prefer to play with Winboard.

Is there any way to kibitz some information of my engine via Polyglot to ICC?

Thanks for your help!

Regards,
Stefan
Stefan Knappe
 

Re: Polyglot & kibitz

Postby Tord Romstad » 08 Feb 2005, 23:15

Stefan Knappe wrote:Hi,

I'd like to participate with my engine (UCI) in the next CCT. Based on some reasons I would prefer to play with Winboard.

Is there any way to kibitz some information of my engine via Polyglot to ICC?

As far as I know, it is not possible. But because PolyGlot is open source and very easy to read and understand, you can easily add this yourself if you want. I have not tested this myself, but I think modifying the function comp_move() in adapter.cpp to something similar to this should work:
Code: Select all
static void comp_move(int move) {

   char string[256];

   ASSERT(move_is_ok(move));

   ASSERT(State==THINKING);
   ASSERT(!Analyse);

   if (!move_to_can(move,string,256)) my_fatal("comp_move(): move_to_can() failed\n");
   xboard_send(XBoard,"move %s",string);
   xboard_send(XBoard,"tellall I am kibitzing!");

   if (option_get_bool("Resign") && RootMoveNb > 1) {

      if (BestValue <= -abs(option_get_int("ResignScore"))) {

         ResignNb++;
         my_log("POLYGLOT %d move%s with resign score\n",ResignNb,(ResignNb>1)?"s":"");

         if (ResignNb >= option_get_int("ResignMoves")) {
            my_log("POLYGLOT *** RESIGN ***\n");
            xboard_send(XBoard,"resign");
         }

      } else {

         if (ResignNb > 0) my_log("POLYGLOT resign reset (ResignNb=%d)\n",ResignNb);
         ResignNb = 0;
      }
   }

   move_step(move);
   no_mess(move);
}

The only thing I have added in the code above is the line
Code: Select all
   xboard_send(XBoard,"tellall I am kibitzing!");


Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Polyglot & kibitz

Postby Stefan Knappe » 09 Feb 2005, 07:39

Hi Tord,

thanks a lot for your recommendation! Perhaps I will try to change and compile Polyglot?!

Nevertheless in my opinion the best way would be if Fabien could implement this feature! I assume a lot of UCI-coders would be pleased with this feature.

What do you think about, Fabien?

Regards,
Stefan
Stefan Knappe
 

Re: Polyglot & kibitz

Postby Anonymous » 09 Feb 2005, 09:22

Hi Stefan,

after Tord's answer, I looked myself in the source of Polyglot. It indeed seems not too difficult, but of course more effort than in Tord's answer. While I suggested on the phone to change polyglot, to fit CCT requirements, after rethinking, the bette place to change would be Winboard/Xboard GUIs. Not only UCI engines would benefit, but also any (new) WB engine. Why should any engine author code almost the same kibitz/whisper stuff. And possibly various options inside the engine, to stop kibitzing/whispering, etc. This belongs to the GUI, really.

My suggestions for the changes to Polyglot adapter.cpp outlined (I don't understand most of the Polyglot code - so be aware).

Add some defines at the top.

#define GOT_PV 1
#define GOT_TIME 2
#define GOT_NODES 4
#define GOT_PONDERMOVE 8

etc., for all the interesting things, that you want to kibitz.

Define some module static vars,

static char last_pv[LASTPVSIZE];

etc. For all the interesting stuff.

and

static unsigned int got_flags = 0;

In function parse_info, in the strcmp ladder, make a copy of all these things. Something like

} else if (strcmp(option,"pv") == 0) {

ASSERT(!my_string_empty(argument));

line_from_can(PV,argument,LineSize);
pv = true;

strncpy(last_pv, argument, LASTPVSIZE); // added for kib support
last_pv[LASTPVSIZE-1] = '\0'; // added
got_flags |= GOT_PV; // added

} else if (strcmp(option,"refutation") == 0) {

and for the other things you want to kibitz later. Than at the location Tord pointed out, construct and send the tellall string with these new static vars, just after sending the move and send it. Then clear got_flags. Stefan, if you want to do the changes, I have cygwin installed and can compile it.

Perhaps little less work and more general would be, to do some additional parsing of "info string". The parser could recognize things like "info string tellics kibitz some stuff" or "info string tellall other stuff" and pass it on to WB. I guess this would take Fabien not more than 5 minutes to implement.

Fabien, under which environement are you starting with Fruit at CCT7? How do you handle the kibitz requirements?

Regards,
Dieter
Anonymous
 

Re: Polyglot & kibitz

Postby Fabien Letouzey » 09 Feb 2005, 09:58

Stefan Knappe wrote:Hi Tord,

thanks a lot for your recommendation! Perhaps I will try to change and compile Polyglot?!

Nevertheless in my opinion the best way would be if Fabien could implement this feature! I assume a lot of UCI-coders would be pleased with this feature.

What do you think about, Fabien?

Regards,
Stefan


Hi all!

I am working on PolyGlot at the moment so small feature requests are welcome.

If a single kibitz at the time a move is played is what you're looking for, Tord's suggestion is correct (search info is available in global variables like BestPV etc ...).

If you want a kibitz at opinion/depth change (new PV), parse_info() becomes the right place (Dieter's suggestion).

In any case, state clearly what you want (preferably discuss this with other interested authors first) and I will do it.

Fabien.
Fabien Letouzey
 
Posts: 110
Joined: 03 Dec 2004, 10:17
Location: France

Re: Polyglot & kibitz

Postby Fabien Letouzey » 09 Feb 2005, 10:07

Dieter B?r?ner wrote:Perhaps little less work and more general would be, to do some additional parsing of "info string". The parser could recognize things like "info string tellics kibitz some stuff" or "info string tellall other stuff" and pass it on to WB. I guess this would take Fabien not more than 5 minutes to implement.


Hi Dieter,

Do I understand correctly that what most UCI authors are after is something like PolyGlot's xboard output: a kibitz for each new PV (either new depth or best move)? Or is one kibitz per move enough?

A version will be available tomorrow. I usually send it to Dann, but if a european has Cygnus GCC it could be made available several hours earlier.

Fabien, under which environement are you starting with Fruit at CCT7? How do you handle the kibitz requirements?


I don't have access myself.
Aaron Gordon will be using ChessPartner.

Fabien.
Fabien Letouzey
 
Posts: 110
Joined: 03 Dec 2004, 10:17
Location: France

Re: Polyglot & kibitz

Postby Fabien Letouzey » 09 Feb 2005, 10:11

Dieter B?r?ner wrote:Perhaps little less work and more general would be, to do some additional parsing of "info string". The parser could recognize things like "info string tellics kibitz some stuff" or "info string tellall other stuff" and pass it on to WB. I guess this would take Fabien not more than 5 minutes to implement.


Sure, a quick hack like this is possible.

However note that all other "info" options are specific to a single search. My conclusion was that "info string" should also be search-specific (e.g. hash hits etc ...). In my implementation, PolyGlot ignores "info" altogether is the search is not current (e.g. has been interrupted).

UCI is very deep and often misunderstood. I am convinced the engine should not be aware of kibitzing.

Of course a quick hack for a single tournament is OK.

Fabien.
Fabien Letouzey
 
Posts: 110
Joined: 03 Dec 2004, 10:17
Location: France

Polyglot & kibitz

Postby Stefan Knappe » 09 Feb 2005, 12:52

Hi Fabien,

at the moment I am mainly interested in to fullfill the CCT-requirements. Therefor I have to post my PV, score and depth after my move is played.

I would prefer to send a "tellall ...." string. Thus I could easy decide to kibitz or to not kibitz. Perhaps there are better ways for implementing!?

Of course a quick hack for a single tournament is OK.


That's sounds very good. Thanks for your help!

Stefan
Stefan Knappe
 

Re: Polyglot & kibitz

Postby Fabien Letouzey » 10 Feb 2005, 09:35

I have just sent an updated version to Dann.
A binary should be available tonight (european time).

Tord has a copy of the source code.

First a word of warning,

I am right in the middle of working on opening-book support and I have
made a few other changes that have not been tested (e.g. "feature done=0"
sent at startup, and immediate answer to a "ping" due to XBoard not
waiting for "pong" before starting a game!).

In case I have introduced a new problem, I - or somebody else - can
add the change to the more-stable PolyGlot 1.2 instead of my current
development version: all lines mentionning "kibitz" in adapter.cpp and
option.cpp

---

Here are the new options ([PolyGlot] section of the INI file):

- KibitzMove (default: false)

Kibitz when playing a move?

- KibitzPV (default: false)

Kibitz when receiving a new PV during search
(same as xboard search information)?

- KibitzCommand (default: "tellall", *don't use quotes*)

Command to send to the xboard interface.

Typical commands are:
- "tellopponent": tell,
- "tellothers": whisper,
- "tellall": kibitz
- "telluser": local GUI?

More information in the xboard-protocol specifications.

- KibitzDelay (default: 5)

Delay in seconds before kibitzing search information.
Move information, when enabled, is not delayed.

---

The [PolyGlot] section should contain something similar to:

KibitzMove = true
KibitzPV = true

KibitzCommand = tellall
KibitzDelay = 10

---

The kibitz string looks like this:

depth=12 time=72.78 node=50580000 speed=694952 score=-0.21 pv="e6 Bd3 Bb4 Bxf5 Nxc3 Qh5 g6 Nxg6 fxg6 Bxg6+ Kd7 Bxh7 Nxa2+ Bd2 Bxd2+ Kxd2"

I did not have the time to do fancy announcements like "score=+M13", etc ...

If you want to change the syntax in the source code,
the function is send_kibitz() in adapter.cpp

---

These changes are not a quick hack and should be available in the next
public version (opening-book support beeing the main feature).

If none of the above is satisfactory for somebody, I can add Dieter's
proposal of using "info string" to communicate (one way) directly with
the xboard interface (at your own risk!).

Good luck,

Fabien.
Fabien Letouzey
 
Posts: 110
Joined: 03 Dec 2004, 10:17
Location: France

Re: Polyglot & kibitz

Postby Tord Romstad » 10 Feb 2005, 15:46

Fabien Letouzey wrote:I have just sent an updated version to Dann.
A binary should be available tonight (european time).

Tord has a copy of the source code.


The code can now be downloaded here;
http://www.math.uio.no/~romstad/polyglot_x.zip

Tord
User avatar
Tord Romstad
 
Posts: 639
Joined: 09 Oct 2004, 12:49
Location: Oslo, Norway

Re: Polyglot & kibitz

Postby Anonymous » 10 Feb 2005, 19:39

Fabien:

>Do I understand correctly that what most UCI authors are after is
>something like PolyGlot's xboard output: a kibitz for each new PV (either
>new depth or best move)? Or is one kibitz per move enough?

Most (WB) engines on ICC or FICS will kibitz only one PV each move - the last calculated. The example line you have shown in a later message is very typical. I personally find it a bit annoying, when engines kib too much - the screen fills up too fast, when watching the game. When also some chatting is going on, one has to scroll all the time. Often there is a chat going on by kibitzing - then it is especially annoying, because one won't have any possibility to easily (by color for example) see the difference between engine kib and kib of persons.

And from another post:

>However note that all other "info" options are specific to a single search.
>My conclusion was that "info string" should also be search-specific (e.g.
>hash hits etc ...).

Yes. An engine kibitz via such a hack would typically also be search specific.

> I am convinced the engine should not be aware of kibitzing.

I agree. As I already mentioned, even an adapter like polyglot is not the best place - the GUI would be even better. It would also give the user the chance to change it dynamically.

But fact is, engines must be at the moment (WB engines, using a free interface, at least).

Your implementations seems well thought through. KibitzMove true will kib a PV, too - yes? You might want to consider to have 2 kibitz commands. Something like kibitzc?mmcandComputer and kibitzc?mmcandHuman. Leaving either empty might be seen as a flag to disable kibitzing.

Regards,
Dieter
Anonymous
 

Re: Polyglot & kibitz

Postby Fabien Letouzey » 11 Feb 2005, 09:43

Tord Romstad wrote:The code can now be downloaded here;
http://www.math.uio.no/~romstad/polyglot_x.zip
Tord


Tord and I now have a Windows binary, but I will have to logout soon.
I am not sure if it has been made available in any way ...

The source code can only be compiled with Cygnus GCC (NOT MinGW or whatever)!

Fabien.
Fabien Letouzey
 
Posts: 110
Joined: 03 Dec 2004, 10:17
Location: France

Re: Polyglot & kibitz

Postby Fabien Letouzey » 11 Feb 2005, 09:44

Dieter B?r?ner wrote:Your implementations seems well thought through. KibitzMove true will kib a PV, too - yes? You might want to consider to have 2 kibitz commands. Something like kibitzc?mmcandComputer and kibitzc?mmcandHuman. Leaving either empty might be seen as a flag to disable kibitzing.


There is only one kibitz syntax. The boolean options only determine when kibitz is sent.

Good idea for human/computer commands!

Fabien.
Fabien Letouzey
 
Posts: 110
Joined: 03 Dec 2004, 10:17
Location: France


Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 47 guests