Author: Tony Werten
Date: 23:56:34 08/02/00
Go up one level in this thread
On August 02, 2000 at 15:03:14, blass uri wrote:
>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
Why not just store all the hashsignatures ( and if you don't hash ep or castle
some bits more ) every time you make a move and check them ?
so
for (i=current_movenumber;i>=last_capturemove_number;i-=2)
{
if (stored_signature[i]==current_hashsignature)
{
number_of_repetitions++
}
}
notice the i-=2. You only have to check the positions with the same player to
move. ( That means if you store a zero when you make a nullmove )
Tony
Tony
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.