[gnu.chess] GNU Chess 1.54 illegal move fix

cracraft@wheaties.ai.mit.edu (Stuart Cracraft) (12/12/89)

A fix for this has been posted before, but it bears repeating.
A serious bug exists in the last released GNU Chess 1.54. If
you have it, either apply this fix or roll back to version
1.53 (from the standard distribution sites) until the
release of version 1.55.

In the fixes below, the filename is listed for the fix and then
the old/new code are listed. Replace the old code with the new code
in the named file for each patch.

--Stuart

/* fix for move.c: */

/* code leading up to fix: */
GenMoves(ply,sq,side,xside)
	/* code omitted ... */
  if (piece == pawn) {
	/* code omitted ... */
    u = p[sq].nextpos; /* and follow no captures thread */

/* old code: */
/*    while (u != sq) {
      if (color[u] == neutral) LinkMove(ply,sq,u,xside); */

/* new code: */
    while (u != sq && color[u] == neutral) {
      	LinkMove(ply,sq,u,xside);

/* end of fix to move.c */

/* ----------------------------------------------- */

/* fix for gnuchess.c */

/* code leading up to fix: */
GenMoves(ply,sq,side,xside)
	/* code omitted ... */
  else if (piece == pawn)
    {
      if (side == white && color[sq+8] == neutral)
        {
          LinkMove(ply,sq,sq+8,xside);
          if (row[sq] == 1)

/* old code: */
/*            if (color[sq+16] == neutral)  */

/* new code: */
            if (color[sq+16] == neutral && color[sq+8] == neutral)

/* end of fix to gnuchess.c */