Article View: gnu.chess
Article #58Re: Gnuchess bug
From: R.Moats
Date: Tue, 28 Nov 1989 18:30
Date: Tue, 28 Nov 1989 18:30
76 lines
2402 bytes
2402 bytes
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
Technical Details
Message-ID:
<6130@cbnewsh.ATT.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!mcdchg!att!cbnewsh!jayhawkReferences:
<1989Nov27.204521.7311@Neon.Stanford.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!mcdchg!att!cbnewsh!jayhawk From: jayhawk@cbnewsh.ATT.COM (R.Moats) Newsgroups: gnu.chess Subject: Re: Gnuchess bug Message-ID: <6130@cbnewsh.ATT.COM> Date: 28 Nov 89 18:30:50 GMT References: <1989Nov27.204521.7311@Neon.Stanford.EDU> Organization: AT&T Bell Laboratories Lines: 76