Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Using Perft to debug a Move Generator?

Author: Russell Reagan

Date: 05:55:12 01/26/04

Go up one level in this thread


On January 26, 2004 at 05:55:58, Steve Maughan wrote:

>I'm currently using Peter McKenzie's excellent PERFT resource to debug the new
>Monarch move generation routines.  Needless to say my number's do not aggree
>with Peter's - I clearly have a couple of bugs.  What I'd like to do is use a
>program like YACE or Delfi which have Perft routines to narrow the search for
>the bugs i.e. look at the subtrees of the positions on Peter's page and narrow
>the bugs down.
>
>So the question is what's the easiest way of setting up a position and running
>Perft?  Do any of the GUIs support ad-hoc commands?
>
>Thanks,
>
>Steve

Winboard will let you send commands by pressing Alt+1. I usually just work in
console mode and use the setboard command to load a FEN string, then type my
perft commands.

You might try Movei. It comes with a link to Winboard that will allow you to use
the Alt+1 stuff, and Movei is probably the fastest public perft calculator
available. I think there are some that use hashing to speed things up, but there
is possible error there.

When numbers differ, I run a slightly different version of perft which dumps out
the perft numbers for each move (at depth-1). So if I get perft 2 from the
initial position as 399, then I run my other perft command, and it will dump out
information like this:

e2e4 20
d2d4 20
c2c4 20
...
h2h3 19 <-- culprit!
h2h4 20
...

So then I know it was after the h2h3 move where something went wrong. This is
particularly helpful when you do a deeper perft and you get a wrong number. That
way you can keep narrowing it down until you find the position that you handle
incorrectly. The really bad bugs are the ones where you get different wrong
results when you run the same perft over and over. I've had times where it goes:

> perft 2
397
> perft 2
386
> perft 2
427

That sucks because when you run the other perft command which spits out perft
counts for each move, you can't narrow things down very much.

The last strategy that I can think of right now is to start out with positions
that only have certain kinds of moves. For instance, I usually start out with
just two kings on the board. Then after I've run perft enough to convince myself
that king moves are good, I add a knight, and so on. That way, when something
does go wrong, I have a pretty good idea of what I know already works and what
the likely culprit is (whatever I added last).

You also might try emailing Tom Likens and asking for a copy of his program. His
has a command (I think 'dperft') that gives some very detailed perft statistics,
such as number of king moves, knight moves, etc., number of castling moves, en
passant moves, promotions, and so on. If you add in support for that in your own
program, then you have another level of detail with which to hunt down the bug.



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.