Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Move generation test suite

Author: Andrew Wagner

Date: 15:58:31 03/31/04

Go up one level in this thread


On March 31, 2004 at 18:36:53, Joshua Shriver wrote:

>What is perft??

It's a function written for the express purpose of testing the move generator.
Generally, the algorithm would be something like this:
int Perft(int d)
{
      Gen_Moves()
      If (d=1)
      {
          Return MoveCount
      }
      else
      {
          for each move
          {
               Make_Move()
               perft += perft(depth-1)
               Take_Back()
          }
      }
}

There are other variations, such as counting the total number of moves
generated, instead of the ending number of positions, or also outputting every
variation, but this is the main idea. It calls itself iteratively, without any
actual searching or looking at the position. This is purely to test and make
sure you're generating the correct number of legal moves from a given position,
and that your MakeMove() and TakeBack() functions are correct. You can also
check out http://homepages.caverock.net.nz/~peter/perft.htm for more info on
this.

>
>Have no idea how a test can be made against a "move generator"
>
>Isn't the move generator just a program that creates the tree structure to hold
>possible moves? So that the evaluator can crawl the tree using A/B or whatever?

Well, yes, but it does so dynamically. You don't want to generate the entire
search tree before searching it, because some branches won't be worth looking
at. However, if indeed you wanted to, Perft() makes sure you can. The "move
generator" in the context I'm using it is just simply your Gen_Moves(),
Make_Move(), and Take_Back() functions. You want to make sure you are very
convinced that these functions are right, because they are tricky, and they get
called millions of times every search.

Hope that helps!
>
>
>Sincerely,
>Joshua Shriver
>
>P.S. STill learning.



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.