Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: correction of some mistakes in my code.

Author: blass uri

Date: 09:47:30 08/03/00

Go up one level in this thread


On August 03, 2000 at 11:07:51, blass uri wrote:

>int reps()
>{
>	int i;
>	int begincircle[32];
>	int endcircle[32];
>	int numcircle=0;
>	int r=0;  /*number of repetitions*/
>	int j=0;
>	if (fifty<=3)
>		return 0;
>	//loop through the reversible moves
>	for (i=hply-1;i>=hply-fifty;--i)
>	{
>		j=0;
>		while ((j<numcircle)&&(begincircle[j]!=endcircle[j]))

Mistake 1:
should be (begincircle[j]!=hist_dat[i].m.b.to)

It was correct in my previous code but
I deleted it by a mistake and added the wrong line.


>			j++;
>		/*if a piece goto the first place of it (begincircle[j] when j<numcircle)
>		then the first place is changed to previous place*/
>		begincircle[j]=hist_dat[i].m.b.from;
>		if (j==numcircle)
>		{
>			endcircle[j]=hist_dat[i].m.b.to;
>			numcircle++;
>		}
>		if ((((i-hply)&1)==0)&&(i<hply-3))
>		{
>			j=0;
>			while ((j<numcircle)&&((color[begincircle[j]]!=color[endcircle[j]])||
>			(piece[begincircle[j]]!=piece[endcircle[j]])))

mistake 2:color[..]==color[..]&&piece[..]==
instead of color[..]!=||coloe[..]!=

I explained this mistake in previous post
>				j++;
>			if (j==numcircle)
>				r++;
>		}
>		if (hist_dat[i].castle!=hist_dat[i-1].castle)

mistake 3:(i) &&(hist_... because in the case that i=0 hist_dat[i-1] is not
defined.

The code is supposed to find if there is a repetition of the position with no
mistakes(except the not important e.p if I have not more bugs).

Uri



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.