🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.chess
Article #5222

Re: Bug in genmoves.c

#5222
From: Roger Uzun
Date: Fri, 21 Jan 1994 17:56
88 lines
3481 bytes
In article <2hnt0j$qe@nuscc.nus.sg> nsrccks@leonis.nus.sg (Chua Kong Sian) writes:
>
>There is a minor bug in CaptureList () in genmoves.c.  For pawn captures
>and promotion, one branch of the capture did not have underpromotion in
>it and the other does.  The fix is very easy.  Just copy the code from
>the other capture branch.
>
>Kong Sian

So to fix this problem is CaptureList () we change the following snippet:
==========OLD CODE APPEARS FIRST FOLLOWED By FIXED CODE FROM CAPTURELIST===

      else
	{
	  pdir = nextdir[ptype[side][piece]][sq];
	  if (piece == pawn && row (sq) == r7)
	    {
	      u = pdir[sq];
	      if (color[u] == xside) // HERE IS THE PROBLEM!!!
		Link (sq, u, capture | promote | queen, valueQ);
	      u = pdir[u];
	      if (color[u] == xside)
		{
		  Link (sq, u, capture | promote | queen, valueQ);
#if !defined OLDXBOARD  && !defined GNU3 && !defined CHESSTOOL
		  Link (sq, u, capture | promote | knight, valueN);
		  Link (sq, u, capture | promote | rook, valueR);
		  Link (sq, u, capture | promote | bishop, valueB);
#endif
		}
	      ppos = nextpos[ptype[side][piece]][sq];
	      u = ppos[sq];	/* also generate non capture promote */
	      if (color[u] == neutral)
		{
		  Link (sq, u, promote | queen, valueQ);
#if !defined OLDXBOARD  && !defined GNU3 && !defined CHESSTOOL
		  Link (sq, u, promote | knight, valueN);
		  Link (sq, u, promote | rook, valueR);
		  Link (sq, u, promote | bishop, valueB);
#endif
		}
	    }

----------------Old Code Above Fixed code below -----------
to:

      else
	{
	  pdir = nextdir[ptype[side][piece]][sq];
	  if (piece == pawn && row (sq) == r7)
	    {
	      u = pdir[sq];
	      if (color[u] == xside)
               {
		Link (sq, u, capture | promote | queen, valueQ);
#if !defined OLDXBOARD  && !defined GNU3 && !defined CHESSTOOL
	        Link (sq, u, capture | promote | knight, valueN);
		Link (sq, u, capture | promote | rook, valueR);
		Link (sq, u, capture | promote | bishop, valueB);
#endif
               }
	      u = pdir[u];
	      if (color[u] == xside)
		{
		  Link (sq, u, capture | promote | queen, valueQ);
#if !defined OLDXBOARD  && !defined GNU3 && !defined CHESSTOOL
		  Link (sq, u, capture | promote | knight, valueN);
		  Link (sq, u, capture | promote | rook, valueR);
		  Link (sq, u, capture | promote | bishop, valueB);
#endif
		}
	      ppos = nextpos[ptype[side][piece]][sq];
	      u = ppos[sq];	/* also generate non capture promote */
	      if (color[u] == neutral)
		{
		  Link (sq, u, promote | queen, valueQ);
#if !defined OLDXBOARD  && !defined GNU3 && !defined CHESSTOOL
		  Link (sq, u, promote | knight, valueN);
		  Link (sq, u, promote | rook, valueR);
		  Link (sq, u, promote | bishop, valueB);
#endif
		}
	    }


--------------------------------------------------------------
bix: ruzun
NET: uzun@crash.cts.com
Technical Details
Message-ID: <1994Jan21.095636.9607@crash>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!cs.utexas.edu!uunet!news.sprintlink.net!crash!uzun
References: <2hnt0j$qe@nuscc.nus.sg>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d71d,5533e6d7f07e23ed
X-Google-Attributes: gid10d71d,public
X-Google-ArrivalTime: 1994-01-21 17:07:14 PST
Newsgroups: gnu.chess
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!howland.reston.ans.net!cs.utexas.edu!uunet!news.sprintlink.net!crash!uzun
From: uzun@crash.cts.com (Roger Uzun)
Subject: Re: Bug in genmoves.c
Organization: CTS Network Services (CTSNET/crash), San Diego, CA
Date: 21 Jan 94 09:56:35 PST
Message-ID: <1994Jan21.095636.9607@crash>
References: <2hnt0j$qe@nuscc.nus.sg>
Lines: 88