Winboard bug?

Discussions about the WinBoard protocol. Here you can also report bugs and request new features.

Moderators: hgm, Andres Valverde

Winboard bug?

Postby Miguel A. Ballicora » 25 Apr 2009, 18:34

In this position

http://webchess.freehostia.com/diag/che ... or3=000000

The game was adjudicated draw by xboard with this message:
Black wins on time but bare king

Miguel
PS: How do I insert the diagram that I show above in the post?
User avatar
Miguel A. Ballicora
 
Posts: 160
Joined: 03 Aug 2005, 02:24
Location: Chicago, IL, USA

Re: Winboard bug?

Postby H.G.Muller » 27 Apr 2009, 16:26

Well, it sure looks like a bug, if you are absolutely certain that the ruling referred to this digram. I cannot spot an error in the code, though:

Code: Select all
       /* [HGM] bare: don't allow bare King to win */
       if((gameInfo.holdingsWidth == 0 || gameInfo.variant == VariantSuper || gameInfo.variant == VariantGreat)
          && result != GameIsDrawn)
       {   int i, j, k=0, color = (result==WhiteWins ? (int)WhitePawn : (int)BlackPawn);
      for(j=BOARD_LEFT; j<BOARD_RGHT; j++) for(i=0; i<BOARD_HEIGHT; i++) {
         int p = (int)boards[forwardMostMove][i][j] - color;
         if(p >= 0 && p <= (int)WhiteKing) k++;
      }
      if (appData.debugMode) {
            fprintf(debugFP, "GE(%d, %s, %d) bare king k=%d color=%d\n",
          result, resultDetails ? resultDetails : "(null)", whosays, k, color);
      }
      if(k <= 1) {
         result = GameIsDrawn;
         sprintf(buf, "%s but bare king", resultDetails);
         resultDetails = buf;
      }
       }

I simply count the number of pieces of the winning side that is between Pawn and King (which should be all pieces), and if it is one, it must be a bare King. Perhaps I am counting on the wrong board here. I guess the clock interrupt causing the forfit ust have come between incrementing the move number and pressing the clock for that move, before the board was fully copied.

Indeed, the MakeMove() routine starts incrementing forwardMostMove, then does SwitchClock(), and only then copies the board. Between forwardMostMove++; and SwitchClocks(); there are only two if() statements, both with false conditions in your case. (One testing if there are more than 500 moves, making the game history overflow, the other a hack for broadcasting the game with my ChessLive! viewer.) So there must be only an extremely short time between them.

But to be absolutely safe I should put the forwardMostMov++; behind updating the board. Yegh. That means I have to replace it by forwardMostMove+1 everywhere in between. And it is used quite often...
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Winboard bug?

Postby webchess » 27 Apr 2009, 17:41

Miguel A. Ballicora wrote:PS: How do I insert the diagram that I show above in the post?


Please read FAQ

Image
Cogito, ergo sum
webchess
 
Posts: 14
Joined: 20 Jul 2008, 07:23
Location: Finland

Re: Winboard bug?

Postby Volker Pittlik » 27 Apr 2009, 17:46

Miguel A. Ballicora wrote:...
PS: How do I insert the diagram that I show above in the post?



http://www.open-aurec.com/wbforum/viewtopic.php?f=22&t=49351
User avatar
Volker Pittlik
 
Posts: 1031
Joined: 24 Sep 2004, 10:14
Location: Murten / Morat, Switzerland

Re: Winboard bug?

Postby Miguel A. Ballicora » 28 Apr 2009, 02:22

Volker Pittlik wrote:
Miguel A. Ballicora wrote:...
PS: How do I insert the diagram that I show above in the post?



http://www.open-aurec.com/wbforum/viewtopic.php?f=22&t=49351


Thanks to both messages,

I read that, and that is how I learned how to build the board. However, It does not say how to insert the image. I think it would be a good idea to complete the howto with this information. In the FAQ says that [img] needs to be used. I actually tried it but I must have done something wrong. Since the howto did not say anything, I gave up too soon.

Miguel
User avatar
Miguel A. Ballicora
 
Posts: 160
Joined: 03 Aug 2005, 02:24
Location: Chicago, IL, USA

Re: Winboard bug?

Postby F. Bluemers » 28 Apr 2009, 16:10

If you quote a message containing a diagram , you can see how its done.
F. Bluemers
 
Posts: 175
Joined: 04 Sep 2008, 16:56
Location: Netherlands


Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 16 guests