Page 1 of 1

Bughouse problem with WinBoard 4.5.1

PostPosted: 02 May 2011, 03:25
by Tony Hecker
I tried using my bughouse engine with WinBoard 4.5.1 on FICS, and I'm seeing some strange messages sent from WinBoard to the engine. It is sending multiple "partner ____" messages, and additional characters get stripped off the beginning of the partner's name with each extra message. (Before trying out 4.5.1, the last version of WinBoard I tried for bughouse was the old 4.2.7 which was working.) I will take a look at the WinBoard source to see if I can figure anything out.

WinBoard debug file output showing the issue:
Code: Select all
<ICS: \007\012\015TJchessB agrees to be your partner.\012\015fics%
ics input 0, castling = 7 0 4 7 0 4
27381 >first : partner TJchessB
27381 >first : partner JchessB
27381 >first : partner chessB
27381 >first : partner hessB
27381 >first : partner essB
27381 >first : partner ssB
27382 >first : partner sB
27382 >first : partner B
27382 >first : partner
27384 <first : tellics partner
>ICS: partner
>ICS: \012
27384 <first : tellics partner TJchessB


edit: Note that I'm using zippyBughouse=1 in the WinBoard command line. Also just tried WB 4.5.2 and the same thing happens.

Re: Bughouse problem with WinBoard 4.5.1

PostPosted: 02 May 2011, 13:43
by H.G.Muller
Surely something fishy is going on here. The 'partner' message is printed from a routine ZippyControl, and I found the following code in the parse loop for ICS output:

Code: Select all
       if (appData.zippyTalk || appData.zippyPlay) {
                /* [DM] Backup address for color zippy lines */
                backup = i;
#if ZIPPY
               if (loggedOn == TRUE)
                       if (ZippyControl(buf, &backup) || ZippyConverse(buf, &backup) ||
                          (appData.zippyPlay && ZippyMatch(buf, &backup)));
#endif
       } // [DM] 'else { ' deleted


Normally 'i' is the input pointer in this loop, and passed to routines that try to match input as &i, so it can be updated to point after anything that ha been matched. But here a copy ' backup' is made, which is then updated in stead, so that 'i' is not updated, and any mathed message will not count as matched.

I guess the idea was that after this a 'colorize' section follows, that matches the same messages, in order to color them before displaying in the console. Apparently originally this was not done in zippy-recognized messages (hence the 'else'), but now it is, with 'i' being effectively reset to before the zippy message. This colorization would then be responsible from the removal of the reognized message from the input.

Here, however, we seem to have a message that is not recognized by the colorization code, so that in the end it is not matched by anything at all. In such a case the matching resumes one character later. Because the part of the message that ZippyControl reognizes is at the end, it is recognized again and again, with ever shorter name at the beginning.

I will have to think a little how this could be fixed; This code would only work if there is a 100% guarantee that everything matched by ZippyControl, ZippyConverse or ZippyMatch is also recognized by the colorization code. Perhaps a safer approach would be to test afterthe colorization code if 'i' now has passed 'backup', and if not, reset it to 'backup' (whih was advanced to after the Zippy-recognized messages).

Re: Bughouse problem with WinBoard 4.5.1

PostPosted: 02 May 2011, 19:29
by H.G.Muller
Can you test if it is solved in http://hgm.nubati.net/WinBoard-TM.zip ?

Re: Bughouse problem with WinBoard 4.5.1

PostPosted: 03 May 2011, 03:56
by Tony Hecker
H.G.Muller wrote:Can you test if it is solved in http://hgm.nubati.net/WinBoard-TM.zip ?


Yes, it is working well now. Thanks! What did you have to change to fix it?

Re: Bughouse problem with WinBoard 4.5.1

PostPosted: 03 May 2011, 07:24
by H.G.Muller
I just moved the "backup = i;" to before the if-statement, and added a

Code: Select all
if(backup > i) { i = backup; continue; }

somewhere downstream, behind the matching for commands to be colorized. So in case the latter code doesn't match anything that would advance 'i', I simulate it has done so. (On a match that code always uses a 'continue' after flushing old input in the old color, and setting the color to the new one.)

The trick was to figure out where exactly to put that; after matching for ICS messages that have to be colorized, the code goes on matching for all kind of other stuff. The variable 'backup' was used nowhere else in the code.

Re: Bughouse problem with WinBoard 4.5.1

PostPosted: 03 May 2011, 14:13
by Tony Hecker
I am now occasionally getting illegal / invalid move popup windows (reported as either from ICS or from engine) during bughouse games. I am not sure if it is a WinBoard problem yet, but I didn't see this before with 4.2.7.

Re: Bughouse problem with WinBoard 4.5.1

PostPosted: 04 May 2011, 05:48
by Tony Hecker
I can't seem to reproduce the illegal move issues anymore. If it happens again I should have a debug log.

Re: Bughouse problem with WinBoard 4.5.1

PostPosted: 06 May 2011, 03:48
by Tony Hecker
It turns out the invalid move problem has to do with resuming an adjourned bughouse game on the ICS. This problem isn't so severe since adjourning and resuming games does not happen all the time. I notice a couple suspicious lines in this debug log:

"Impossible move from ICS: 'P@e3'"
"Feeding moves 22 through 22 to first chess program"

Code: Select all
33308731 >first : new
random
33308731 >first : ics freechess.org
33308732 >first : post
33308732 >first : hard
33308732 >first : easy
33308732 >first : ping 77
<ICS: You have an adjourned game with Boedi; issuing a continuation.\012\015Game is bughouse; issuing a continuation TJChessA vs Aritz.\012\015Boedi is not partnered with Aritz.\012\015fics%
ics input 0, castling = 7 0 4 7 0 4
33308780 <first : pong 76
33308810 <first : pong 77
<ICS: \012\015zybasty(24): not me\012\015fics%
ics input 0, castling = 7 0 4 7 0 4
<ICS: \012\015Challenge: Boedi (2137) TJchessB (1990) unrated bughouse 3 0 (adjourned).\012\015\007You can "accept" or "decline", or propose different parameters.\012\015fics%
ics input 0, castling = 7 0 4 7 0 4
recognized 'bughouse' (-1) as variant bughouse
>ICS: $accept Boedi\012
<ICS: You accept the match offer from Boedi.\012\015\012\015Your partner has joined a match with Aritz.\012\015fics% \012\015Creating: TJchessB (1990) Boedi (2137) unrated bughouse 3 0 (adjourned)\012\015{Game 375 (TJchessB vs. Boedi) Continuing unrated bughouse match.}\012\015Your partner is playing game 384 (Aritz vs. TJChessA).\012\015\007\012\015<12> r-b----r ppNk-pp- --npp-qp -------- ---P---- --P-PN-- P-P--PPP R--QKB-R W -1 1 1 0 0 0 375 TJchessB Boedi 1 3 0 32 32 169562 166944 12 K/e8-d7 (0:02.500) Kd7 0 1 0\012\015<b1> game 375 white [BQ] black [PBQ]\012\015\012\015\015fics%
ics input 0, castling = 7 0 4 7 0 4
Ratings from 'Creating:' TJchessB 1990, Boedi 2137
recognized 'unrated bughouse match.' (-1) as variant bughouse
Switch board from normal to bughouse
shuffleOpenings = 0
Parsing board: r-b----r ppNk-pp- --npp-qp -------- ---P---- --P-PN-- P-P--PPP R--QKB-R W -1 1 1 0 0 0 375 TJchessB Boedi 1 3 0 32 32 169562 166944 12 K/e8-d7 (0:02.500) Kd7 0 1 0

>ICS: $moves 375\012
recognized 'ICS unrated bughouse match' (-1) as variant bughouse
ParseBoard says variant = 'ICS unrated bughouse match'
recognized as bughouse
Remembered ratings: W 1990, B 2137
load 8x8 board
33326824 >first : variant bughouse
33326824 >first : level 0 3 0
33326824 >first : name Boedi
33326825 >first : rating 1990 2137
parseboard 22, castling = 9 2 6 45 45 0
accepted move Kd7 from ICS, parse it.
moveNum = 22
board = 2-10 x 8
Move parsed to 'Kd7 (0:02.500)'
nps: w=-1, b=-1
silence
Parsing holdings: game 375 white [BQ] black [PBQ]
, currentMove = 22
33326827 >first : holding [BQ] [PBQ]
<ICS: \012\015Movelist for game 375:\012\015\012\015TJchessB (1990) vs. Boedi (2137) --- Thu May  5, 07:58 CST 2011\012\015Unrated bughouse match, initial time: 3 minutes, increment: 0 seconds.\012\015\012\015Move  TJchessB                Boedi              \012\015----  ---------------------   ---------------------\012\015  1.  e4      (0:00.100)      e6      (0:00.531)   \012\015  2.  Nc3     (0:00.100)      Nc6     (0:00.100)   \012\015  3.  Nf3     (0:00.100)      Nf6     (0:00.100)   \012\015  4.  d4      (0:00.100)      Bb4     (0:00.100)   \012\015  5.  Bg5     (0:00.100)      h6      (0:01.187)   \012\015  6.  Bxf6    (0:02.386)      Qxf6    (0:00.100)   \012\015  7.  e5      (0:00.789)      Qg6     (0:00.703)   \012\015  8.  P@e3    (0:01.462)      Bxc3+   (0:04.735)   \012\015  9.  bxc3    (0:01.169)      d6      (0:02.109)   \012\015 10.  exd6    (0:01.877)      cxd6    (0:00.891)   \012\015 11.  N@c7+   (0:02.255)      Kd7     (0:02.500)   \012\015      {Still in progress} *\012\015\012\015fics%
ics input 22, castling = 9 2 6 45 45 0
recognized 'ICS Unrated bughouse match' (-1) as variant bughouse
Parsing game history: TJchessB                Boedi             
----  ---------------------   ---------------------
  1.  e4      (0:00.100)      e6      (0:00.531)   
  2.  Nc3     (0:00.100)      Nc6     (0:00.100)   
  3.  Nf3     (0:00.100)      Nf6     (0:00.100)   
  4.  d4      (0:00.100)      Bb4     (0:00.100)   
  5.  Bg5     (0:00.100)      h6      (0:01.187)   
  6.  Bxf6    (0:02.386)      Qxf6    (0:00.100)   
  7.  e5      (0:00.789)      Qg6     (0:00.703)   
  8.  P@e3    (0:01.462)      Bxc3+   (0:04.735)   
  9.  bxc3    (0:01.169)      d6      (0:02.109)   
 10.  exd6    (0:01.877)      cxd6    (0:00.891)   
 11.  N@c7+   (0:02.255)      Kd7     (0:02.500)   
      {Still in progress} *
trial -1,-1,-1,-1  type 0000
trial -1,-1,-1,-1  type 0000
trial -1,-1,-1,-1  type 0000
trial 1,-1,-1,-1  type 1000
trial -1,-1,-1,-1  type 0000
trial -1,-1,4,4  type 0021
Disambiguate in:  0(-1,-1)-(6,3) = 0 (-)
Disambiguate out: 0(6,1)-(6,3) = 0 (-)
CoordsToAlgebraic, piece=0 (6,1)-(6,3) -
9 2 6 9 2 6 Legality test? e2e4
movetype=21, promochar=0=-
MateTest: K=1, my=16, his=16
trial -1,-1,4,6  type 0021
Disambiguate in:  22(-1,-1)-(6,5) = 0 (-)
Disambiguate out: 22(6,6)-(6,5) = 0 (-)
CoordsToAlgebraic, piece=22 (6,6)-(6,5) -
9 2 6 9 2 6 Legality test? e7e6
movetype=21, promochar=0=-
MateTest: K=1, my=16, his=16
trial 2,-1,-1,-1  type 1000
trial -1,-1,-1,-1  type 0000
trial -1,-1,2,3  type 0021
Disambiguate in:  1(-1,-1)-(4,2) = 0 (-)
Disambiguate out: 1(3,0)-(4,2) = 0 (-)
CoordsToAlgebraic, piece=1 (3,0)-(4,2) -
MateTest: K=1, my=16, his=16
trial -1,-1,2,6  type 0021
Disambiguate in:  23(-1,-1)-(4,5) = 0 (-)
Disambiguate out: 23(3,7)-(4,5) = 0 (-)
CoordsToAlgebraic, piece=23 (3,7)-(4,5) -
MateTest: K=1, my=16, his=16
trial 3,-1,-1,-1  type 1000
trial -1,-1,-1,-1  type 0000
trial -1,-1,5,3  type 0021
Disambiguate in:  1(-1,-1)-(7,2) = 0 (-)
Disambiguate out: 1(8,0)-(7,2) = 0 (-)
CoordsToAlgebraic, piece=1 (8,0)-(7,2) -
MateTest: K=1, my=16, his=16
trial -1,-1,5,6  type 0021
Disambiguate in:  23(-1,-1)-(7,5) = 0 (-)
Disambiguate out: 23(8,7)-(7,5) = 0 (-)
CoordsToAlgebraic, piece=23 (8,7)-(7,5) -
MateTest: K=1, my=16, his=16
trial 4,-1,-1,-1  type 1000
trial -1,-1,-1,-1  type 0000
trial -1,-1,3,4  type 0021
Disambiguate in:  0(-1,-1)-(5,3) = 0 (-)
Disambiguate out: 0(5,1)-(5,3) = 0 (-)
CoordsToAlgebraic, piece=0 (5,1)-(5,3) -
9 2 6 9 2 6 Legality test? d2d4
movetype=21, promochar=0=-
MateTest: K=1, my=16, his=16
trial -1,-1,1,4  type 0021
Disambiguate in:  24(-1,-1)-(3,3) = 0 (-)
Disambiguate out: 24(7,7)-(3,3) = 0 (-)
CoordsToAlgebraic, piece=24 (7,7)-(3,3) -
MateTest: K=1, my=16, his=16
trial 5,-1,-1,-1  type 1000
trial -1,-1,-1,-1  type 0000
trial -1,-1,6,5  type 0021
Disambiguate in:  2(-1,-1)-(8,4) = 0 (-)
Disambiguate out: 2(4,0)-(8,4) = 0 (-)
CoordsToAlgebraic, piece=2 (4,0)-(8,4) -
MateTest: K=1, my=16, his=16
trial -1,-1,7,6  type 0021
Disambiguate in:  22(-1,-1)-(9,5) = 0 (-)
Disambiguate out: 22(9,6)-(9,5) = 0 (-)
CoordsToAlgebraic, piece=22 (9,6)-(9,5) -
9 2 6 9 2 6 Legality test? h7h6
movetype=21, promochar=0=-
MateTest: K=1, my=16, his=16
trial 6,-1,-1,-1  type 1000
trial -1,-1,-1,-1  type 0000
trial -1,-1,5,6  type 0021
Disambiguate in:  2(-1,-1)-(7,5) = 0 (-)
Disambiguate out: 2(8,4)-(7,5) = 0 (-)
CoordsToAlgebraic, piece=2 (8,4)-(7,5) -
MateTest: K=1, my=15, his=16
trial -1,-1,5,6  type 0021
Disambiguate in:  26(-1,-1)-(7,5) = 0 (-)
Disambiguate out: 26(5,7)-(7,5) = 0 (-)
CoordsToAlgebraic, piece=26 (5,7)-(7,5) -
MateTest: K=1, my=15, his=15
trial 7,-1,-1,-1  type 1000
trial -1,-1,-1,-1  type 0000
trial -1,-1,4,5  type 0021
Disambiguate in:  0(-1,-1)-(6,4) = 0 (-)
Disambiguate out: 0(6,3)-(6,4) = 0 (-)
CoordsToAlgebraic, piece=0 (6,3)-(6,4) -
9 2 6 9 2 6 Legality test? e4e5
movetype=21, promochar=0=-
MateTest: K=1, my=15, his=15
trial -1,-1,6,6  type 0021
Disambiguate in:  26(-1,-1)-(8,5) = 0 (-)
Disambiguate out: 26(7,5)-(8,5) = 0 (-)
CoordsToAlgebraic, piece=26 (7,5)-(8,5) -
MateTest: K=1, my=15, his=15
trial 8,-1,-1,-1  type 1000
trial -1,-1,-1,-1  type 0000
trial -1,-1,4,3  type 0021
LegalDrop: 0 @ 6,2)
Impossible move from ICS: 'P@e3'
board L=2, R=10, H=8, holdings=2
Feeding moves 22 through 22 to first chess program
33327024 >first : variant bughouse
33327025 >first : force
time odds: 1.000000 1.000000
33327025 >first : time 16956
33327025 >first : otim 16694
book hit = (NULL)
33327025 >first : go
33327037 <first : 3 -129 0 984 b1c3
33327038 <first : 3 -129 0 1285 b1c3 P@d4 c3d5
33327039 <first : 4 -153 0 2150 b1c3
33327042 <first : 4 -146 0 11168 g1f3
33327043 <first : 4 -146 0 11168 g1f3 P@d6 b1c3 b8c6
33327049 <first : 5 -140 0 25410 g1f3
33327050 <first : 5 -140 1 28255 g1f3 P@d6 b1c3 g8f6 f3d4
33327060 <first : 6 -139 1 51014 g1f3
33327072 <first : 6 -139 3 76488 g1f3 P@f6 b1c3 b8c6 c3d5 g8h6
33327106 <first : 7 -141 3 155045 g1f3
33327119 <first : 7 -141 8 191571 g1f3 P@f6 b1c3 b8c6 c3e4 g8h6 e4c5
33327202 <first : 8 -142 8 430719 g1f3
33327239 <first : 8 -142 20 502703 g1f3 P@d6 f3g5 g8h6 B@d3 B@g8 b1c3 b8c6
33327550 <first : 9 -153 20 1225966 g1f3
33327809 <first : 9 -153 77 1930455 g1f3 b8c6 b1c3 P@b4 c3b5 g8f6 b5d4 f6e4 d4c6
33328254 <first : 10 -151 77 3099199 g1f3
33328416 <first : 10 -151 137 3509479 g1f3 b8c6 b1c3 P@d6 B@c4 g8h6 c3e4 B@g8 c4d5 h6f5
33329189 <first : 11 -157 137 5418219 g1f3
<ICS: \012\015<b1> game 375 white [BQ] black [PNBQ] <- BN\012\015fics%
ics input 22, castling = 9 2 6 45 45 0
Parsing holdings: game 375 white [BQ] black [PNBQ] <- BN
, currentMove = 22
33329885 >first : holding [BQ] [PNBQ] BN
33331349 <first : 11 -157 431 10484293 g1f3 b8c6 b1c3 P@d6 f3g5 g8h6 c3e4 c6e5 B@d5 a7a5 g5f3
33334714 <first : 12 -158 431 18677489 g1f3
33340459 <first : 12 -158 1342 32797742 g1f3 b8c6 b1c3 g8f6 f3g5 B@h4 c3e4 f6e4 g5e4 P@d6 a2a4
33348205 <first : 13 -167 1342 51703134 g1f3
33369521 <first : 13 -167 4248 101182019 g1f3 b8c6 b1c3 g8f6 f3g5 B@h4 c3e4 P@e6 e4f6 g7f6 g5f7 h4f2 e1f2
33400746 <first : 14 -158 4248 172028097 g1f3
33412007 <first : 14 -158 8497 199095007 g1f3 b8c6 b1c3 g8f6 e2e3 f6g4 f1c4 c6e5 f3e5 g4e5 c4d3 P@c4
<ICS: \012\015\012\015    **ANNOUNCEMENT** from relay: FICS is relaying the 41st International Chess Tournament Bosna \012\015\   2011 - Round 3, the 10th Asian Individual Championships - Round 4 and the Candidates Matches\012\015\   2011 - Round 1 Game 1. To find more about Relay type "tell relay help"\012\015\012\015fics%
ics input 22, castling = 9 2 6 45 45 0
silence
33493597 <first : move g1f3
machine move 22, castling = 9 2 6 45 45 0
trial 6,1,5,3  type 2121
9 2 6 45 45 0 Legality test? g1f3
<ICS: \012\015\015
ics input 22, castling = 9 2 6 45 45 0
<ICS: \007\012\015<12> r-b----r ppNk-pp- --npp-qp -------- ---P---- --P-PN-- P-P--PPP R--QKB-R W -1 1 1 0 0 0 375 TJchessB Boedi 1 3 0 32 35 -1515 166944 12 K/e8-d7 (0:02.500) Kd7 0 1 0\012\015<b1> game 375 white [BQ] black [PNBQ]\012\015fics% \012\015{Game 375 (TJchessB vs. Boedi) TJchessB forfeits on time} 0-1\012\015\012\015{Game 384 (Aritz vs. TJChessA) Aritz's partner won} 1-0\012\015\012\015No ratings adjustment done.\012\015fics%
ics input 22, castling = 9 2 6 45 45 0
Parsing board: r-b----r ppNk-pp- --npp-qp -------- ---P---- --P-PN-- P-P--PPP R--QKB-R W -1 1 1 0 0 0 375 TJchessB Boedi 1 3 0 32 35 -1515 166944 12 K/e8-d7 (0:02.500) Kd7 0 1 0

load 8x8 board
parseboard 22, castling = 9 2 6 45 45 -23
accepted move Kd7 from ICS, parse it.
moveNum = 22
board = 2-10 x 8
Move parsed to 'Kd7 (0:02.500)'
nps: w=-1, b=-1
silence
Parsing holdings: game 375 white [BQ] black [PNBQ]
, currentMove = 22
33498000 >first : holding [BQ] [PNBQ]
GameEnds(26, TJchessB forfeits on time, 0)
33498003 >first : result 0-1 {TJchessB forfeits on time}