Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Perft(4) and Perft(5) for Gothic Chess

Author: Russell Reagan

Date: 22:50:29 01/07/04

Go up one level in this thread


On January 08, 2004 at 01:36:30, Ed Trice wrote:

>Something happened during ply 5 of the iteration. I am not sure if I am doing
>the perft properly since it required a great deal of unraveling of the move
>generator.

You shouldn't have to touch the move generator, or anything else in your
program, in order to calculate perft. Assuming you have a function to do each of
these things, your perft calculator might look like this (untested code):

int Perft (int depth)
{
    int count = 0;

    if ( depth == 0 )
        return 1;

    GenerateLegalMoves();

    while ( MovesLeft() )
    {
        MakeNextMove();
        count += Perft(depth - 1);
        UndoMove();
    }

    return count;
}

Then to do perft 3, you call Perft(3).


>I also was spawning large text files, writing every move to disk as a
>double check.

There is no need to do any of that. Just count nodes. If several programs get
the same counts consistently, that is a good indication that your move
generator, make move, and undo move functions are working correctly.



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.