Computer Chess Club Archives


Search

Terms

Messages

Subject: Request for code snippet for checking repetative moves

Author: Michel Langeveld

Date: 02:45:42 11/08/00


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.