Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: A question about debugging my move generator

Author: Uri Blass

Date: 04:02:37 06/20/01

Go up one level in this thread


On June 20, 2001 at 06:31:59, Peter McKenzie wrote:

>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.
>
>Good to hear you are writing a chess program Uri, you'll have alot of fun!
>
>>>
>>>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:
>
>Nice to hear that someone still finds that useful!
>
>>
>> 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..
>
>Yeah, I wanted a position where all the funny moves would come up within a few
>ply.
>
>>
>>
>>>Is there a faster way to debug the move generator?
>
>Plenty of asserts certainly help.
>
>It would be better if you could get the node counts at say 1 ply and 2 ply for
>all the positions in a test suite.  Then you could diff them with the known
>results and hunt down errors much faster.  A bit of hacking to crafty and you
>could probably do this, but in the same time you could also probably debug your
>move generator too...
>
>It sounds like you are doing it the 'hard way', in that you are trying to
>calculate legal moves statically without using search to figure out anything.

Yes
I do it in this way.

  I
>do this in my program, and it is a fun thing to do, but it is definitely more
>difficult than letting search figure out if a move leaves you in check or not.
>
>If you are doing it statically, beware of the following scenario:
>
>BK a4, BP e4, WK h8, WR h4, WP d2
>
>Now, if white plays d2-d4 your move generator might think it can play exd4 en
>passant because the pawn on e4 is not pinned!

You are right.
I need to care for it.

I see that I even forgot to check for enpassant if the pawn is pinned and I
generate every pseudo en passant move.

Fortunately it changes nothing in the first 5 plies of the game.

I also can generate moves faster.

For example instead of generating the attack tables for every square in every
move I can use the last move to ignore part of the squares and to do it faster
but before doing it I prefer to care that my move generator have no mistakes.

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.