Author: blass uri
Date: 12:03:14 08/02/00
Here is my repetition code for TSCP
I changed some things relative to the original code.
The original code assume that there is repetition if the empty squares are the
same and it is not correct.
My code assume that the position is the same only if the pieces did circles
when circle can be Ra1-b1-a1 or longer trip when the final square is identical
to the first square.
There are cases when my code may miss repetition(for example it may miss a case
when the rook in a1 goto b1 and the rook in b1 goto a1) but I prefer to be wrong
by not seeing repetition then by seeing wrong repetitions.
Tom told me in an email about the last fact and I admit that I did not see it
for his email.
I did not understand i>=hply-fifty-1 in the original code and changed it to
i>=hply-fifty
I also considered the fact that repetition is relevant only if the side to move
is the same and that repetition is not relevant if the side to castle was
changed.
please tell me if I have errors in my code.
Here is my repetition function.
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]!=hist_dat[i].m.b.to))
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++;
}
else
{
j=0;
if ((i-hply)&1==0)
if (i<hply-3)
while ((j<numcircle)&&(begincircle[j]==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.