WinBoard and FRC

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 and FRC

Postby H.G.Muller » 25 Jun 2008, 18:15

I just fixed an alpha version of WinBoard_F that should be fully FRC compatible. The previous versions has some problems when playing on ICS, in particular when resuming an adjourned game. I had never tested them for ICS play, so they only worked for engine-engine games.

The current version ( http://home.hccnet.nl/h.g.muller/alpha.tst , rename to winboard.exe) is extensively tested on ICC, and seems to correctly handle castling rights when playing, and when restoring an adjourned game.

This was not trivial, as WinBoard turns out to use completely different mechanisms for local playing and for ICS play: in local playing each new position is derived from the previous position, and the move the engine or user sends it. In ICS play, the previous position is completely ignored, and the position as it will be after the move is loaded from the ICS. The position description sent by ICS does also contain the castling rights (not as FEN, alas), but in FRC the transmitted castling rights are in general wrong! (Only corner Rooks get castling rights, and if two Rooks are on the same side of the King, the format does not allow spcifying which Rook has the rights...) But when resuming an adjourned game, the positions are again derived from previous positions by moves, but in a slightly different way from when engines play (using ApplyMove() rather than MakeMove()). So it was a very messy operation.

I would be very grateful if people could try out the alpha.tst in normal Chess and FRC, on local engine-engine and ICS play (playing, resuming, observing other games) to see if everything works, and if I haven't broken anything.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: WinBoard and FRC

Postby Pedro Castro » 25 Jun 2008, 20:47

Thx HGM,

Just a comment, so that an engine winboard can play in winboard_f FRC should support castling format HAha instead of KQkq. So perhaps you (another engines winboard) should make a small change in the funtion setboard to correct castling rights.

DanaSah ---> in arena o chessgui

Code: Select all
      if ((strcmp (gui,"arena") == 0) || (strcmp (gui,"chessgui") == 0)) {
         enroque = 0;
         c = string[i++];
         while (c == 'K' || c == 'Q' || c == 'k' || c == 'q') {
            if (c == 'K') {
               enroque = enroque + 1;
            }
            if (c == 'Q') {
               enroque = enroque + 2;
            }
            if (c == 'k') {
               enroque = enroque + 4;
            }
            if (c == 'q') {
               enroque = enroque + 8;
            }
            c = string[i++];
         }      
      }


DanaSah--> in Winboard_f

Code: Select all
      if (strcmp (gui,"winboard") == 0) {
                  enroque = 0;
         c = string[i++];
         while ((c >= 'A' && c <= 'H') || (c >= 'a' && c <= 'h')) {
            if (c >= 'A' && c <= 'H') {
               r = 65 + COLUMNA(rb);
               if (c > r) {
                  enroque = enroque + 1;
                  tb1 = c - 'A' + 56;
               }
               if (c < r) {
                  enroque = enroque + 2;
                  tb2 = c - 'A' + 56;
               }
            }
            if (c >= 'a' && c <= 'h') {
               r = 97 + COLUMNA(rn);
               if (c > r) {
                  enroque = enroque + 4;
                  tn1 = c - 'a';
               }
               if (c < r) {
                  enroque = enroque + 8;
                  tn2 = c - 'a';
               }
            }
            c = string[i++];      
         }
      }
Best wishes,

Pedro Castro
User avatar
Pedro Castro
 
Posts: 180
Joined: 28 Jan 2005, 01:09
Location: Pays Basque (Spain)

Re: WinBoard and FRC

Postby Teemu Pudas » 25 Jun 2008, 22:18

Here's what I'm doing.

Code: Select all
void convert_fen(char fen[], bool to_shredder) { // no-op if it's already in the specified format
   int pos = 0;
   char rook[4] = {'\0','\0','\0','\0'}; // in qkQK order
   char king[2] = {'\0','\0'}; // black,white
   int c;
   int i = 0;
   int size = strlen(fen);
   
   char file = 'a';

   for (int colour = 0; colour < 2; colour++) {
      char file_h = colour ? 'H' : 'h';
      char my_rook = colour ? 'R' : 'r';
      char my_king = colour ? 'K' : 'k';
      while (pos < size && (c = fen[pos++]) != '/' && file <= file_h) {
         if (c >= '1' && c <= '7')
            file += c - '1';
         if (c == my_rook) {
            if (king[colour]) rook[2*colour+1] = file; // to the right of the king -> kingside
            else if (!rook[2*colour]) rook[2*colour] = file;
         }
         if (c == my_king)
            king[colour] = file;
         file++;

      }
      while (i++ < 6) // skip ranks 7 through 2
         while (pos < size && fen[pos++] != '/');
      file = 'A';
   }

   pos++;
   while (pos < size - 1 && (c = fen[++pos]) != ' ') {
      if (to_shredder) {
         if (c == 'q' && rook[0]) fen[pos] = rook[0]; // avoid mangling FENs that were incorrect in the first place
         if (c == 'k' && rook[1]) fen[pos] = rook[1];
         if (c == 'Q' && rook[2]) fen[pos] = rook[2];
         if (c == 'K' && rook[3]) fen[pos] = rook[3];
      } else { // to X-FEN, then.
         if (c >= 'a' && c <= 'h') {
            if (c < king[0] && c == rook[0]) fen[pos] = 'q'; // don't do anything to inner rooks because no compatible GUI uses proper X-FEN
            if (c > king[0] && c == rook[1]) fen[pos] = 'k';
         } else if (c >= 'A' && c <= 'H') {
            if (c < king[1] && c == rook[2]) fen[pos] = 'Q';
            if (c > king[1] && c == rook[3]) fen[pos] = 'K';
         }
      }
   }
}
Teemu Pudas
 
Posts: 124
Joined: 16 Apr 2007, 14:03

Re: WinBoard and FRC

Postby H.G.Muller » 25 Jun 2008, 22:55

For correct implementation of FRC edit-position functionality you need to understand both KQkq and AHah. And current Arena doesn't support this functionality anyway.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL


Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 34 guests