Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Repetition Detection

Author: Volker Annuss

Date: 03:41:59 12/02/04

Go up one level in this thread


On December 01, 2004 at 17:01:34, Michel Langeveld wrote:

>int reps(void)
>{
>   int i;
>   int r = 0;
>
>   for (i = hply - fifty; i < hply; ++i)
>      if (hist_dat[i].hash == dynhash)
>         ++r;
>   return r;
>}
>
>Let me know if you can optimize this even more further.

int reps(void)
{
   int i;
   int r = 0;
   int min_i = hply-fifty;

   if ( ply_from_last_nullmove > min_i )
      min_i = ply_from_last_nullmove;

   for (i = hply-4; i >= min_i; i -= 2 )
      if (hist_dat[i].hash == dynhash)
         ++r;
   return r;
}



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.