Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question about debugging my move generator

Author: Uri Blass

Date: 03:35:26 06/20/01

Go up one level in this thread


On June 20, 2001 at 05:26:48, Daniel Clausen wrote:

>Hi
>
>On June 20, 2001 at 04:36:44, Uri Blass wrote:
>>I use the perft command in crafty in order to debug my move generator.
>>
>>I found that perft 4 gave me correct result when perft 5 does not give me
>>correct result and I got 4865621 instead of 4865609.
>>
>>After finding it
>>I calculated the perft 4 after every legal move and found that perft 4 does not
>>give correct result after 1.d3
>>
>>After finding it I checked perft 3 after d3 to see where my program is wrong
>>and found that after 1.d3 c5 I got 15972 instead of 15971.
>>
>>I now need to continue in this way to check where is the error.
>
>Personally I found the position/numbers given in KiwiPete's finger notes on CCC
>to be extremely useful to debug my move generator:
>
> 6: The following position is a move generation test.  Listed are the number
>    of different games from that position to ply 1,2,3,4, and 5.
> 7: r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -
> 8: 48; 2,039; 97,862; 4,085,603; 193,690,690
>
>The position includes all move-types I could think of, which the initial
>position obviously doesn't. (ie promotion, castling after 5 plies) Obviously a
>'setup position' feature is needed to use this though..

Setup positions is not needed
The following loop is enough to generate every legal position.

while (ply<numplies)
{
   gen();
   makemove(gen_dat[first_move[ply]+a[ply]].m.b);
}

The only problem is to calculate the game that gives the position
and to calculate the array a[ply](for example 1.e4 means a[0]=11 in my program)
so it may be faster to generate setup position function.

I can add that I corrected the mistake of assuming that
1.d3 c5 2.Kd2 Qa5 3.Ke1 is a leagl game so perft 5 gives correct result for the
initial position.

My mistake was that I used ~x instead of x==0(I have no variable with the name x
in my program and I used a long expression).
x is truth but the problem is that ~x is also not 0 and is also truth.

Uri



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.