Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Help with a little debug question

Author: Rick Bischoff

Date: 21:00:17 10/17/04

Go up one level in this thread



>I get 20 at ply 1
>I get 400 at ply 2 (20 responses)
>But I only get 8882 at ply 3 (reguardless of wether black starts first or white)
>
>I have checked all the special move, double pawn moves, ep moves, castling and
>can't seem to find
>the error.

Since it is only perft 3, and since your number is too low,  the problem is most
likely in your diagonal moves.  e.g., after e4, you should have Be2-d3-c4-b5-a6
and Qe2-f3-g4-h5.

However, if it isn't that obvious....

The easiet way I found to debug a move generator was to do the following at
ply=0 on a call to perft(n):

for every move:
make the move.
run perft(n-1) and store the result
print out the current fen and the perft(n-1) result
add the perft(n-1) result to your total
unmake the move

Now, armed with this information, you should have 20 fens with perft(2) run on
them.  You go into crafty, and I find it is easiest to do the following:

crafty> xboard
force
setboard fen-for-position-1
perft 2

(you can do this without putting crafty into xboard mode, but it starts to think
automatically if it is black on the move, and I never looked for a way to turn
that off since I knew the xboard protocol already)

Check the crafty result and your program result.  If they match, go to the next
move.
If they don't,

modify your main routine so that it makes this move first,
set the ply back to zero
run perft(2)
and repeat

eventually you will find the position where perft 1 is wrong and you can easily
check this by hand.



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.