Article View: gnu.chess
Article #5716Bug fix for 3.1 (now that we are using this one!)
From: Joe Peterson
Date: Thu, 11 Jun 1992 14:04
Date: Thu, 11 Jun 1992 14:04
31 lines
1852 bytes
1852 bytes
I found a bug in gnuchess 3.1 that is worth picking up if you want to use
it with xboard or whatever. The bug occurs if you try to undo a move that
had resulted in a pawn promotion. Gnuchess 3.1 checks for promotion by
tracing the path of the piece back to the start of the game to see if it
was in a pawn row (pretty interesting hack to get around the fact that
there was no promotion flag!). There is an "order of precedence" C bug
in one of the tests that makes gnuchess demote non-pawn pieces to pawns.
Of course, xboard (or Xchess in my case) does not know that gnuchess thinks
the piece is now a pawn! Here is the fix:
Old code (in function Undo in file nondsp.c):
/* Check for promotion: */
if ((row (f) == 6 && row (t) == 7) || (row (f) == 1 && row (t) == 0))
{
int g, from = f;
for (g = GameCnt - 1; g > 0; g--)
--> if (GameList[g].gmove & 0xFF == from) <--
from = GameList[g].gmove >> 8;
if (row (from) == 1 || row (from) == 6)
board[t] = pawn;
}
Change the above marked line to:
if ((GameList[g].gmove & 0xFF) == from)
This bug exists (I think) in the other "dsp" files as well, but gnuchessr
is the one you want for xboard anyway...
Enjoy!
Joe Peterson
joe@avs.com
Technical Details
Message-ID:
<1992Jun11.140420.6608@ctr.columbia.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!joeShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d71d,14511a8e6a4f2f57,start X-Google-Attributes: gid10d71d,public X-Google-ArrivalTime: 1992-06-11 01:40:34 PST Newsgroups: gnu.chess Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!joe From: joe@AVS.COM (Joe Peterson) Subject: Bug fix for 3.1 (now that we are using this one!) Organization: Advanced Visual Systems Inc. Message-ID: <1992Jun11.140420.6608@ctr.columbia.edu> Sender: news@ctr.columbia.edu (The Daily Lose) Date: Thu, 11 Jun 1992 14:04:20 GMT X-Posted-From: sol.ctr.columbia.edu Lines: 31