dalgic@bodega.stanford.edu (Ismail Dalgic) (11/28/89)
I have the GnuChess version 1.53, and several times I noticed a very disturbing bug. The program "forgets" about the piece in front of a pawn in its original rank when it advances the pawn by 2. Here is a game list which will indicate what I mean. Black is GnuChess. I played it with 60 moves/5 min. mode. 1. e2e4 e7e5 2. g1f3 d7d6 3. d2d4 g8f6 4. c1g5 e5d4 5. d1d4 b8c6 6. f1b5 c8d7 7. b5c6 d7c6 8. b1c3 f8e7 9. c3d5 c7c5 !!! Any ideas, fixes etc??? --Ismail Dalgic
pjbk@cs.hw.ac.uk (Peter King) (11/29/89)
In article <1989Nov27.204521.7311@Neon.Stanford.EDU> dalgic@bodega.stanford.edu (Ismail Dalgic) writes: >I have the GnuChess version 1.53, and several times I noticed a very >disturbing bug. The program "forgets" about the piece in front of a >pawn in its original rank when it advances the pawn by 2. Here is a >game list which will indicate what I mean. Black is GnuChess. I >played it with 60 moves/5 min. mode. > > 1. e2e4 e7e5 > 2. g1f3 d7d6 > 3. d2d4 g8f6 > 4. c1g5 e5d4 > 5. d1d4 b8c6 > 6. f1b5 c8d7 > 7. b5c6 d7c6 > 8. b1c3 f8e7 > 9. c3d5 c7c5 !!! > > >Any ideas, fixes etc??? > >--Ismail Dalgic The version of gnuchess I have doesn't seem to have a version number of any sort, but I retrieved it last week from an archive and its date there is in August. The date in the main gnuchess.c is April 1988, but ther is some conditional compilation using a NEWMOVE preprocessor variable. With that set to 0, the problem described does not occur. With NEWMOVE=12 (the default) it does. The problem is in the file move.c, and a patch follows. *** move.c Thu Jun 22 05:31:06 1989 --- nmove.c Tue Nov 28 16:05:53 1989 *************** *** 334,339 u = p[sq].nextpos; /* and follow no captures thread */ while (u != sq) { if (color[u] == neutral) LinkMove(ply,sq,u,xside); u = p[u].nextpos; } } --- 334,340 ----- u = p[sq].nextpos; /* and follow no captures thread */ while (u != sq) { if (color[u] == neutral) LinkMove(ply,sq,u,xside); + else break; /*cannot make initial pawn two rank move if blocked! */ u = p[u].nextpos; } } -- Peter King, Computer Science Department JANET: pjbk@uk.ac.hw.cs Heriot-Watt University ARPA: pjbk@cs.hw.ac.uk 79 Grassmarket, Edinburgh EH1 2HJ or pjbk%cs.hw.ac.uk@ucl-cs Phone: (+44) 31 225 6465 Ext. 555 UUCP: ..!ukc!cs.hw.ac.uk!pjbk
jayhawk@cbnewsh.ATT.COM (R.Moats) (11/29/89)
From article <1989Nov27.204521.7311@Neon.Stanford.EDU>, by dalgic@bodega.stanford.edu (Ismail Dalgic): > I have the GnuChess version 1.53, and several times I noticed a very > disturbing bug. The program "forgets" about the piece in front of a > pawn in its original rank when it advances the pawn by 2. Here is a > game list which will indicate what I mean. Black is GnuChess. I > played it with 60 moves/5 min. mode. > > 1. e2e4 e7e5 > 2. g1f3 d7d6 > 3. d2d4 g8f6 > 4. c1g5 e5d4 > 5. d1d4 b8c6 > 6. f1b5 c8d7 > 7. b5c6 d7c6 > 8. b1c3 f8e7 > 9. c3d5 c7c5 !!! > > > Any ideas, fixes etc??? > > --Ismail Dalgic Yep, the problem is in GenMoves() in move.c The proper GenMoves() function is below GenMoves(ply,sq,side,xside) short ply,sq,side,xside; /* Generate moves for a piece. The moves are taken from the precalulated array posdata. If the board is free, next move is choosen from nextpos else from nextdir. */ { register short u,piece; register struct sqdata *p; piece = board[sq]; p = posdata[side][piece][sq]; if (piece == pawn) { u = p[sq].nextdir; /* follow captures thread */ while (u != sq) { if (color[u] == xside) LinkMove(ply,sq,u,xside); u = p[u].nextdir; } u = p[sq].nextpos; /* and follow no captures thread */ while (u != sq) { if (color[u] == neutral && (u != sq+16 || color[u-8] == neutral) && (u != sq-16 || color[u+8] == neutral)) { LinkMove(ply,sq,u,xside); } u = p[u].nextpos; } } else { u = p[sq].nextpos; while (u != sq) { if (color[u] == neutral) { LinkMove(ply,sq,u,xside); u = p[u].nextpos; } else { if (color[u] == xside) LinkMove(ply,sq,u,xside); u = p[u].nextdir; } } } } ------- Ryan Moats AT&T Bell Laboratories Holmdel NJ rdmi@homxb.att.com
chpetk@gdr.bath.ac.uk (Toby Kelsey) (11/29/89)
In article <1989Nov27.204521.7311@Neon.Stanford.EDU> dalgic@bodega.stanford.edu (Ismail Dalgic) writes: >I have the GnuChess version 1.53, and several times I noticed a very >disturbing bug. The program "forgets" about the piece in front of a >pawn in its original rank when it advances the pawn by 2. I came across the same bug. After looking at the code I found that the making the following change to "move.c" corrected the error. - output of 'diff move.c move.c.old' - 335,336c335,336 < while ((u != sq) && (color[u] == neutral)) { < LinkMove(ply,sq,u,xside); --- > while (u != sq) { > if (color[u] == neutral) LinkMove(ply,sq,u,xside); This is in the pawn-move section (obviously!). This makes it checks squares only until it reaches a non-empty one. [ I'm not sure of my version, "gnuchess.c" mentions revision 4-25-88, and the last date in "CHANGES" is Aug. 1 '89 ] >--Ismail Dalgic - Toby. -- Toby Kelsey UUCP : ...!ukc!gdr!chpetk School of Chemistry, DARPA: chpetk%gdr.bath.ac.uk@nsf-relay.ac.uk University of Bath. JANET: chpetk@uk.ac.bath.gdr