Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Request for code snippet for checking repetative moves

Author: Bas Hamstra

Date: 06:30:40 11/08/00

Go up one level in this thread


bool ThreeRep(int Ply)

{  if(   (HashValue == HashHistory[Ply-4]) ||
         (HashValue == HashHistory[Ply-8]) ||
         (HashValue == HashHistory[Ply-12])

     )   return true;

    return false;
}

That will catch most of them.

Regards,
Bas.

On November 08, 2000 at 05:45:42, Michel Langeveld wrote:

>Does someone know a way to check for repetative moves in the correct way.
>To help a bit I added this piece of code.
>
>THashTable h;
>
>int negamax(int depth)
>{
>   int best = -MAXINT;
>   int score;
>
>   if ( draw(board) )
>   {
>      return 0;
>   }
>
>   if ( mate(board) )
>   {
>      return -9999;
>   }
>
>   TMovelist m = makemovelist(board);
>
>   for (int i=0; i<movecount; i++)
>   {
>       make_move(movelist[i], board);
>       score = -negamax(depth-1)
>       if (score > best)
>       {
>           best = score;
>       }
>       undo_move(movelist[i], board);
>   }
>   return best;
>}



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.