Winboard interface

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

Winboard interface

Postby H.G.Muller » 02 Jan 2007, 11:56

Is there some generic main() available (in C) for a Winboard-compatible engine? I mean something that implements the interpreter loop for all the Winboard commands, including setting, starting and stopping the various clocks and variables describing the search-limiting parameters (MaxDepth, TimeLeft, MovesLeft), to which I only have to supply routines Init(), InitBoard(), ThinkAndMove(), PrintMove(), ParseAndMove() to build a Winboard-compatible engine?
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard interface

Postby Pradu » 02 Jan 2007, 17:27

H.G.Muller wrote:Is there some generic main() available (in C) for a Winboard-compatible engine? I mean something that implements the interpreter loop for all the Winboard commands, including setting, starting and stopping the various clocks and variables describing the search-limiting parameters (MaxDepth, TimeLeft, MovesLeft), to which I only have to supply routines Init(), InitBoard(), ThinkAndMove(), PrintMove(), ParseAndMove() to build a Winboard-compatible engine?
I guess there isn't a generic one but I follow TSCP's way of handling the WB protocol:

Code: Select all
while(fgets(line,LINE_SIZE,stdin))
{
    char command[LINE_SIZE];
    sscanf(line,"%s",command);
    if(!strcmp(command,"go"))
    {
        ...
    }
    else if(!strcmp(command,"new"))
    {
        ...
    }
}


Modified a little (Input in it's own thread) it can also handle pondering quite well. I have a generic search and a timemanager. Before I start pondering I call setEndTime(); then call infTime(); (flag to search forever) After oppononent makes a move and it was a ponder hit I call finiteTime(); (flag to search until end time, if passed beyond end time it will play immediately). You can also put the commands into two groups, state-changing commands and quering commands to help figure out how to handle the commands while searching.
User avatar
Pradu
 
Posts: 343
Joined: 12 Jan 2005, 19:17
Location: Chandler, Arizona, USA

Re: Winboard interface

Postby H.G.Muller » 02 Jan 2007, 18:00

I was indeed tempted to steal the TSCP code, but I am not sure how I should handle time control. This part of the protocol seems quite confusing. There are two clocks, and one of them measures the time that the computer is thinking, and the other starts running when the computer gives of the move and stops when a move is entered or one of the commands that stops the clock? And if I change colors by a black, white or go command, the clocks are not affected? (i.e. the clock that used to measure time for white might now measure time for black?)

How about setting the clock with the time or otime command? Should this be time used or time left??? Do the clocks count down? If I use the level or st command, does it affect the clocks, or are the clocks only affected by the new command, based on the last level or st command given before it, and do such commands have no effect on a game being in progress?

If the depth is limited by sd, should the engine still pay attention to time?
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard interface

Postby Uri Blass » 02 Jan 2007, 18:40

H.G.Muller wrote:I was indeed tempted to steal the TSCP code, but I am not sure how I should handle time control. This part of the protocol seems quite confusing. There are two clocks, and one of them measures the time that the computer is thinking, and the other starts running when the computer gives of the move and stops when a move is entered or one of the commands that stops the clock? And if I change colors by a black, white or go command, the clocks are not affected? (i.e. the clock that used to measure time for white might now measure time for black?)

How about setting the clock with the time or otime command? Should this be time used or time left??? Do the clocks count down? If I use the level or st command, does it affect the clocks, or are the clocks only affected by the new command, based on the last level or st command given before it, and do such commands have no effect on a game being in progress?

If the depth is limited by sd, should the engine still pay attention to time?


I do not understand part of your questions
You say:

1)There are two clocks, and one of them measures the time that the computer is thinking, and the other starts running when the computer gives of the move and stops when a move is entered or one of the commands that stops the clock?

***What is exactly the question here?

2)And if I change colors by a black, white or go command, the clocks are not affected? (i.e. the clock that used to measure time for white might now measure time for black?)

***Again I do not understand why you need to care about it.
basically winboard give you the time that you have before every move by time and the time that your opponent has by otime so I think that you have all the details

3)How about setting the clock with the time or otime command? Should this be time used or time left???

***time and otime are time left.

4)Do the clocks count down?
***I do not understand the question

5)If I use the level or st command, does it affect the clocks, or are the clocks only affected by the new command, based on the last level or st command given before it, and do such commands have no effect on a game being in progress?

***usually you should get the level command only at the beginning of the game. The new command tell you that there is a new game and other commands later will tell you about the clock.
no reason for level command before new

6)If the depth is limited by sd, should the engine still pay attention to time?[/quote]

***Yes
If you want it not to do it you can practically use long time control
that is going to achieve the same effect.
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: Winboard interface

Postby H.G.Muller » 02 Jan 2007, 20:19

1) is this correct or not?
2) When the computer starts playing again with the other color as before, should I swap the time on the clocks or not?
3) OK. Time left is then to the next time control? So if I set the level to, say, 40 moves per hour, and white (the computer) just did its 40th move, and both sides have used 59 minutes, I should expect Winboard to send time 366000 and otime 6000?
4) Does the clock measure elapsed time since the beginning or time left to the next time control.
5) OK. So these commands are only issued immediately after new, and if the engine recieves them it should immediately set TimeLeft for both clocks to the given time, and MovesLeft for both sides to the given number of moves. Is that correct? Like TimeLeft, MovesLeft is also not swapped when the computer gets to play the other side.
6) OK. This seemed to follow from the protocol description, but it is not what TSCP does (it does change time per move on receiving the sd command), which confused me.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard interface

Postby Uri Blass » 02 Jan 2007, 22:43

H.G.Muller wrote:1) is this correct or not?
2) When the computer starts playing again with the other color as before, should I swap the time on the clocks or not?
3) OK. Time left is then to the next time control? So if I set the level to, say, 40 moves per hour, and white (the computer) just did its 40th move, and both sides have used 59 minutes, I should expect Winboard to send time 366000 and otime 6000?
4) Does the clock measure elapsed time since the beginning or time left to the next time control.
5) OK. So these commands are only issued immediately after new, and if the engine recieves them it should immediately set TimeLeft for both clocks to the given time, and MovesLeft for both sides to the given number of moves. Is that correct? Like TimeLeft, MovesLeft is also not swapped when the computer gets to play the other side.
6) OK. This seemed to follow from the protocol description, but it is not what TSCP does (it does change time per move on receiving the sd command), which confused me.


1)Yes it is correct
2)You do not need to care about swapping times.
The interface always tell you the time that you have and the time that the opponent when it is your turn to move.

3)winboard always send the time that you have correctly
I am not sure about the time of the opponent but I practically do not use it.

You get the time commands *only* when it is your turn to move
and immediatly after it you get a move.

Assuming both you and your opponent used 59 minutes for the first moves
If it is move 40 for you then you get time 6000
If it is move 41 for you then you get time 366000
I think that the time of the opponent is the same but I am not sure about the case that the opponent white and played move 40.

4)When you get time X it means time left to the next time control
and not time that you used

5)the engine does not need to set time left after getting the level command and it can set time left only after getting the time command.

The advantage of the level command is that you know more information than the time left to the next time control.

You may want to use more time if you know that you have 40 moves for 40 minutes and not 40 moves for all the game and you can know it only based on the level command that you get in the beginning.

tscp is a simple program so it does not use that information and always use the same proportion of the time left

6)tscp may have bugs here but if the target is to play fixed depth match it is not important because you can set time control that is long enough to allow playing the fixed depth match and get the same result.

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: Winboard interface

Postby H.G.Muller » 02 Jan 2007, 23:03

OK, thanks. I will try to implement this. It is reassuring to know that the engine will be told on any move how much time it has left, and not just, say, when the user would decide to enter the time left on some clock external to the computer to Winboard. It would have to keep track itself of the number of moves left, though. In principle this can be a source of confusion too, if Winboard would make the computer swap sides quite a lot (at the request of the user, or whatever). In the extreme case, if the engine would play both sides because it would receive new go commands after every move it played, it could have used 60 minutes of time for 40 moves while white and black would each have used 30 minutes for 20 moves.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard interface

Postby H.G.Muller » 09 Jan 2007, 00:16

OK, I wrote a generic main(), which is basically a driver to interface an engine with Winboard, (basically adapted from the TSCP xboard() routine), and I fused it with micro-Max.

But it gets stuck! :shock:

When I use Winboard to play this micro-Max against TSCP both engines do a few moves (5 or so), and then all action stops and only micro-Max' clock counts down to zero. According to the task manager the micro-Max process still exists, but it doesn't use any CPU time or any other resource.

What could be the problem here, and how can I hunt it down?
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard interface

Postby Jim Ablett » 09 Jan 2007, 08:04

Hard to tell without see the code, but sounds like a buffer io problem.
Is the buffer being flushed after every printf ?

This is the code snippet I used when I added winboard support
to Vanillachess. This does away with having to flush buffer after
every printf. Stick it at the start of Main().

Code: Select all
setbuf(stdout, NULL);
setbuf(stdin, NULL);
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stdin, NULL, _IONBF, 0);


Jim.
___________________________
http://jimablett.net63.net/
Jim Ablett
 
Posts: 721
Joined: 27 Sep 2004, 10:39
Location: Essex, England

Re: Winboard interface

Postby H.G.Muller » 09 Jan 2007, 10:14

This is the generic version. The one I am actually running has the various calls to engine functions adapted to the corresponding micro-Max code (caal or in-lined), but I don't think the problem could be there (since it does work for a few moves).

The thing is entirely based on the xboard loop of TSCP, and when I have TSCP playing itself no problems occur. Could it be a problem if one of the engines moves too fast?
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <time.h>


int ReadMove(char *s)
{

   /* make sure the string looks like a move */
   if (s[0] < 'a' || s[0] > 'h' ||
         s[1] < '0' || s[1] > '9' ||
         s[2] < 'a' || s[2] > 'h' ||
         s[3] < '0' || s[3] > '9')
      return -1;

        /* syntax OK, bring in engine representation */
        READ_MOVE;

        return 0;
}



/* Generic main() for Winboard-compatible engine     */
/* (Inspired by TSCP)                                */
/* Author: H.G. Muller                               */

/* The engine is invoked through the following       */
/* subroutines, that can draw on the global vaiables */
/* that are maintained by the interface:             */
/* Side         side to move                         */
/* Move         move input to or output from engine  */
/* PromPiece    requested piece on promotion move    */
/* TimeLeft     ms left to next time control         */
/* MovesLeft    nr of moves to play within TimeLeft  */
/* MaxDepth     search-depth limit in ply            */
/* Post         boolean to invite engine babble      */

/* InitEngine() progran start-up initialization      */
/* InitGame()   initialization to start new game     */
/*              (sets Side, but not time control)    */
/* Think()      think up move from current position  */
/*              (leaves move in Move, can be invalid */
/*               if position is check- or stalemate) */
/* DoMove()     perform the move in Move             */
/*              (togglese Side)                      */
/* ReadMove()   convert input move to engine format  */
/* PrintMove()  print Move on standard output        */
/* Legal()      check Move for legality              */
/* ClearBoard() make board empty                     */
/* PutPiece()   put a piece on the board             */

/* define this to the codes used in your engine,     */
/* if the engine hasn't defined it already.          */
#define EMPTY
#define WHITE
#define BLACK

/* make unique integer from engine move representation */
#define PACK_MOVE ...

/* convert intger argument back to engine move representation */
#define UNPACK_MOVE(A) ...

/* Global variables visible to engine. Normally they */
/* would be replaced by the names under which these  */
/* are known to your engine, so that they can be     */
/* manipulated directly by the interface.            */

int Side;
int Move;
int PromPiece;
int Result;
int TimeLeft;
int MovesLeft;
int MaxDepth;
int Post;

int GameHistory[1024];
int GamePtr;


int main()
{
        int Computer, MaxTime, MaxMoves, TimeInc, sec;
   char line[256], command[256];
        int m, nr;
        clock_t t;

   signal(SIGINT, SIG_IGN);
   printf("\n");
        InitEngine();
        InitGame();
        Computer = EMPTY;
        MaxTime  = 10000;  /* 10 sec */
        MaxDepth = MAXPLY; /* maximum depth of your search */

        for (;;) {
      fflush(stdout);
                if (Side == Computer) {
                        /* think up & do move, measure time used  */
                        /* it is the responsibility of the engine */
                        /* to control its search time based on    */
                        /* MovesLeft, TimeLeft, MaxMoves, TimeInc */
                        /* Next 'MovesLeft' moves have to be done */
                        /* within TimeLeft+(MovesLeft-1)*TimeInc  */
                        /* If MovesLeft<0 all remaining moves of  */
                        /* the game have to be done in this time. */
                        /* If MaxMoves=1 any leftover time is lost*/
                        t = clock();
                        Think();
                        if (!Legal()) {
                                Computer = EMPTY;
            continue;
         }
                        DoMove();
                        printf("move ");
                        PrintMove();
                        printf("\n");
                        m = (clock() - t)*1000/CLOCKS_PER_SEC;

                        GameHistory[GamePtr++] = PACK_MOVE;
                        PrintResult();

                        /* time-control accounting */
                        TimeLeft -= m;
                        TimeLeft += TimeInc;
                        if(--MovesLeft == 0) {
                            MovesLeft = MaxMoves;
                            if(MaxMoves == 1)
                                 TimeLeft  = MaxTime;
                            else TimeLeft += MaxTime;
                        }
         continue;
      }
      if (!fgets(line, 256, stdin))
         return;
      if (line[0] == '\n')
         continue;
      sscanf(line, "%s", command);
      if (!strcmp(command, "xboard"))
         continue;
      if (!strcmp(command, "new")) {
                        /* start new game */
                        InitGame();
                        GamePtr   = 0;
                        Computer  = BLACK;
                        TimeLeft  = MaxTime;
                        MovesLeft = MaxMoves;
         continue;
      }
      if (!strcmp(command, "quit"))
                        /* exit engine */
         return;
      if (!strcmp(command, "force")) {
                        /* computer plays neither */
                        Computer = EMPTY;
         continue;
      }
      if (!strcmp(command, "white")) {
                        /* set white to move in current position */
                        Side     = WHITE;
                        Computer = BLACK;
         continue;
      }
      if (!strcmp(command, "black")) {
                        /* set blck to move in current position */
                        Side     = BLACK;
                        Computer = WHITE;
         continue;
      }
      if (!strcmp(command, "st")) {
                        /* move-on-the-bell mode     */
                        /* indicated by MaxMoves = 1 */
                        sscanf(line, "st %d", &MaxTime);
                        MovesLeft = MaxMoves = 1;
                        TimeLeft  = MaxTime *= 1000;
                        TimeInc   = 0;
         continue;
      }
      if (!strcmp(command, "sd")) {
                        /* set depth limit (remains in force */
                        /* until next 'sd n' command)        */
                        sscanf(line, "sd %d", &MaxDepth);
         continue;
      }
                if (!strcmp(command, "level")) {
                        /* normal or blitz time control */
                        sec = 0;
                        if(sscanf(line, "level %d %d %d",
                                 &MaxMoves, &MaxTime, &TimeInc)!=3 &&
                           sscanf(line, "level %d %d:%d %d",
                                 &MaxMoves, &MaxTime, &sec, &TimeInc)!=4)
                             continue;
                        MovesLeft = MaxMoves;
                        TimeLeft  = MaxTime = 60000*MaxTime + 1000*sec;
                        TimeInc  *= 1000;
                        continue;
                }
      if (!strcmp(command, "time")) {
                        /* set time left on clock */
                        sscanf(line, "time %d", &TimeLeft);
                        TimeLeft  *= 10; /* centi-sec to ms */
         continue;
      }
      if (!strcmp(command, "otim")) {
                        /* opponent's time (not kept, so ignore) */
         continue;
      }
      if (!strcmp(command, "go")) {
                        /* set computer to play current side to move */
                        Computer = Side;
         continue;
      }
      if (!strcmp(command, "hint")) {
                        Think();
                        if (!Legal())
            continue;
                        printf("Hint: ");
                        PrintMove();
                        printf("\n");
         continue;
      }
                if (!strcmp(command, "undo")   && (nr=1) ||
                    !strcmp(command, "remove") && (nr=2)   ) {
                        /* 'take back' moves by replaying game */
                        /* from history until desired ply      */
                        if (GamePtr < nr)
            continue;
                        GamePtr -= nr;
                        InitGame();
                        for(nr=0; nr<GamePtr; nr++) {
                            UNPACK_MOVE(GameHistory[nr]);
                            DoMove();
                        }
         continue;
      }
      if (!strcmp(command, "post")) {
                        Post = 1;
         continue;
      }
      if (!strcmp(command, "nopost")) {
                        Post = 0;
         continue;
      }
                if (!strcmp(command, "edit")) {
                        int color = WHITE;

                        while(fgets(line, 256, stdin)) {
                                m = line[0];
                                if(m=='.') break;
                                if(m=='#') {
                                        ClearBoard();
                                        continue;
                                }
                                if(m=='c') {
                                        color = WHITE+BLACK - color;
                                        continue;
                                }
                                if((m=='P' || m=='N' || m=='B' ||
                                    m=='R' || m=='Q' || m=='K')
                                    && line[1] >= 'a' && line[1] <= 'h'
                                    && line[2] >= '1' && line[2] <= '8') {
                                        PutPiece(color);
                                        continue;
                                }
                        }
         continue;
      }
                /* command not recoognized, assume input move */
                m = ReadMove(line);
                if (m == -1)
                        /* doesn't have move syntax */
         printf("Error (unknown command): %s\n", command);
                else if(!Legal())
                        /* did have move syntax, but illegal move */
                        printf("Illegal move:%s\n", line);
                else {  /* legal move, perform it */
                        GameHistory[GamePtr++] = PACK_MOVE;
                        DoMove();
                        PrintResult();
      }
   }
}

User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard interface

Postby Jim Ablett » 09 Jan 2007, 11:39

Does bug it happen in all time controls i.e tournament, fixed time per move etc?

A winboard debug would also be helpful.

Jim.
___________________________
http://jimablett.net63.net/
Jim Ablett
 
Posts: 721
Joined: 27 Sep 2004, 10:39
Location: Essex, England

Re: Winboard interface

Postby H.G.Muller » 09 Jan 2007, 12:34

I have only tried it in normal time control (40 moves per 5 minutes).

I have about zero experience with Winboard, and have only a vague nootion of what it can do or how it works. This is why I tried to hijack an existing working interface, and generalize it, rather than writing my own from scratch. So what is a 'winboard debug'? Is there a way to monitor the communication between Winboard and the engine?
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard interface

Postby Jim Ablett » 09 Jan 2007, 12:51

I don't know if this is significant >

Code: Select all
if (!strcmp(command, "white")) {
                        /* set white to move in current position */
                        Side     = WHITE;
                        Computer = BLACK;
         continue;
      }
      if (!strcmp(command, "black")) {
                        /* set blck to move in current position */
                        Side     = BLACK;
                        Computer = WHITE;
         continue;
      }



According to Tim Mann's Winboard Protocol Documents the above is correct, but I've never implemented it like that and I checked a random source (Pierre and that doesn't implement it like that either.

My commands in Vanillachess and SCP (and Pierre) are like this (and work ok):

Code: Select all
if (!strcmp(command, "white")) {
                        /* set white to move in current position */
                        Side     = WHITE;
                        Computer = SIDE;
                        Opponent = BLACK;

         continue;
      }
      if (!strcmp(command, "black")) {
                        /* set blck to move in current position */
                        Side     = BLACK;
                        Computer = SIDE;
                        Opponent = WHITE;
         continue;
      }


Jim.
___________________________
http://jimablett.net63.net/
Jim Ablett
 
Posts: 721
Joined: 27 Sep 2004, 10:39
Location: Essex, England

Re: Winboard interface

Postby Jim Ablett » 09 Jan 2007, 13:06

So what is a 'winboard debug'? Is there a way to monitor the communication between Winboard and the engine?


Start up winboard and in the 'additional options' box type
'/debug' then start as usual. A file will be written 'winboard.debug'
containing all communication information between engines and gui.

Jim.
___________________________
http://jimablett.net63.net/
Jim Ablett
 
Posts: 721
Joined: 27 Sep 2004, 10:39
Location: Essex, England

Re: Winboard interface

Postby Odd Gunnar Malin » 09 Jan 2007, 13:22

Instead of using TSCP as a template, I think its better to use the protocoltext itself. Whatever have been told, you can't be sure to get time/otim command before a move.

To not poll when thinking and not respond to a useraction, especially to move now (?), is kind of rude to the user. If he want to abort and start closing winboard etc. it could lead to a blue screen (win 95/98) and some unsaved work are lost.

I'm sure you find the bug including this in the line with (nr=1).

Odd Gunnar
Odd Gunnar Malin
 
Posts: 9
Joined: 29 Sep 2004, 08:10
Location: Vads?, Norway

Re: Winboard interface

Postby H.G.Muller » 09 Jan 2007, 14:12

Code: Select all
if (!strcmp(command, "white")) {
                        /* set white to move in current position */
                        Side     = WHITE;
                        Computer = SIDE;
                        Opponent = BLACK;

         continue;
      }
      if (!strcmp(command, "black")) {
                        /* set blck to move in current position */
                        Side     = BLACK;
                        Computer = SIDE;
                        Opponent = WHITE;
         continue;
      }

This seems rather similar to what I have, except that the variable Opponent doesn't exist in my case. (It doesn't seem an independent variable, it seems that the state is totally defined by who is to move on the board and the side that the computer should automatically perform the moves for. If the engine in some of its functions would need to set an explicit variable for who is not to move, it can derive it from Side before calling those functions (like Think() or Legal() ).)

Is there any significance that in Computer=SIDE you spell it in capitals? What is the difference between Side and SIDE?

The line with (nr=1) is unlikely to cause the error, since it would only be called upon when the engine recieves an undo or remove command, and I don't see why Winboard would ever send such a command in the course of a game between two machines being in progress.

Anyway, I will try the /debug tonight, to see if I can figure out in which command the protocol gets stuck.

As for the time-control commands: the protocol text is not very clear about their meaning either. So I tried to not rely on the assumption of what a GUI using Winboard protocol would send me, but try to do time accounting as independently as possible. So that in case the GUI wouldn't send me any of those, I still get sensible behavior. So the computer does keep track of its own time used in thinking, and does not rely on time commands to update its clock (only to synchronize it). And on setting a time control trhough level or st, it also sets the clock and the move count according to this, so that it is not dependent on additional time commands for the new time-control regime getting in force, even if you don't start a new game. And on new it also resets the clock, so that you are not dependent on the order of new and level comands. The protocol text did not specify at all how the engine should react on a level command recieved while a game is in progress, but it also doesn't guarantee that it will never be send in such a situation.

I do not keep opponent's time, though, since I could not imagine that there would exist engines that would use this information. This might be a mistake, since it is conceivable that engines would alter their playing style if they see that their opponent is cramped for time. So I guess to keep generality, I should also maintain a variable OpponentsTime.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard interface

Postby Odd Gunnar Malin » 09 Jan 2007, 14:51

[
Code: Select all
if (!strcmp(command, "white")) {
                        /* set white to move in current position */
                        Side     = WHITE;
                        Computer = SIDE;
                        Opponent = BLACK;

         continue;
      }
      if (!strcmp(command, "black")) {
                        /* set blck to move in current position */
                        Side     = BLACK;
                        Computer = SIDE;
                        Opponent = WHITE;
         continue;
      }


Instead of creating your own comment in lines like above I use Tim Mann's protocol text here:
Code: Select all
/* white (WB)
 *
 * Set White on move. Set the engine to play Black. Stop clocks.
 */
if (!strcmp(command, "white"))
{
  ......
}

Then it easy to see bugs like the above (Opponent=BLACK)

HGM's interpreting seems ok, except if he want to do the clock stuff.
Odd Gunnar Malin
 
Posts: 9
Joined: 29 Sep 2004, 08:10
Location: Vads?, Norway

Re: Winboard interface

Postby H.G.Muller » 09 Jan 2007, 22:54

OK, with the help of the debug mode I figured it out.

It was not an error in the protocol at all. The error was in the way I interfaced it with the engine. Due to the fact that the new control loop handles one move, while the original uMax control loop handles one ply, the hash table was not cleared often enough, and as a consequence it sometimes failed to find a move due to a hash hit in the root, and that somehow made it shut up silently. (No move normally means checkmate or stalemate, but uMax doesn't print a result message.)

After clearing the hash table also before taking an input move, the winboard-compatible micro-Max runs fine. So it seems the generic xboard driver above is OK. I might still expand it to handle otime, computer, hard and easy commands, though (although uMax doesn't use that information).

Thanks for the assistance!
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard interface

Postby Jim Ablett » 10 Jan 2007, 00:02

That's great. I've been itching to try out Micro-max in a chess gui. When's the projected release date ?

Jim.
___________________________
http://jimablett.net63.net/
Jim Ablett
 
Posts: 721
Joined: 27 Sep 2004, 10:39
Location: Essex, England

Re: Winboard interface

Postby Guenther Simon » 10 Jan 2007, 00:11

H.G.Muller wrote:After clearing the hash table also before taking an input move, the winboard-compatible micro-Max runs fine. So it seems the generic xboard driver above is OK.


Does this mean you completely clean the hash now for each new
move, or do you mean the clearing of only older hash entries?

Guenther
User avatar
Guenther Simon
 
Posts: 794
Joined: 26 Sep 2004, 19:49
Location: Regensburg, Germany

Next

Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 25 guests