Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: I a little behind, a simple question?

Author: Andrew Wagner

Date: 15:18:01 05/23/04

Go up one level in this thread


On May 23, 2004 at 17:43:46, William Bryant wrote:

>Could you provide a basic description of the perft result.
>
>I think I understand, but how does perft1 differ from perft2 etc...
>
>William


Perft is a recursive function that many engines have in order to test their move
generator. Pete Skinner's web page talks about it:
http://homepages.caverock.net.nz/~peter/perft.htm

The basic algorithm is:

int perft(int depth)
{
   Generate_Moves();
   If (depth == 1)
       return Num_Moves;
   else
   {
       for (int j = 0; j < Num_Moves)
       {
            Make_Move(Move(j));
            perft += perft(depth - 1);
            Take_Back();
       }
   }
}

So, for the root position, Perft(1) should return 20, because White has 20
possible moves. Perft(2) should return 400, because for each of White's first
moves, Black has 20 responses (20 * 20 = 400), and so on. I hope this helps.
Andrew



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.