Author: blass uri
Date: 08:07:51 08/03/00
Here is my latest repetition code for TSCP
I hope that my code cover all the cases.
I simply instead of checking that begincircle[i]=endcircle[i] decided to check
that the piece and the color is the same.
I hope that there ae no errors.
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]))
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]])))
j++;
if (j==numcircle)
r++;
}
if (hist_dat[i].castle!=hist_dat[i-1].castle)
return r;
}
return r;
}
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.