perft question

Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc

Moderator: Andres Valverde

perft question

Postby Sven Schüle » 19 Jan 2005, 00:40

Hi,

I have a question about perft. If a mate or draw (e.g. stalemate) occurs at depth D with D < MAX_DEPTH and I am calculating perft(MAX_DEPTH), does this leaf node count for the perft number or not? Note that I mean the real perft number, not the total number of nodes visited.

On http://homepages.caverock.net.nz/~peter/perft.htm, Peter McKenzie states:
If a checkmate or stalemate is reached before the specified depth is reached then of course that branch of the search tree will not reach the specified depth.

and later on:
The result of a perft search is the number of nodes reached at the specified depth.


I have the impression that such nodes do not count but I want to be sure. I have implemented perft for Surprise now, but my numbers are slightly different, and it seems to be related to mate positions.

Cheers,
Sven
User avatar
Sven Schüle
 
Posts: 240
Joined: 26 Sep 2004, 20:19
Location: Berlin, Germany

Re: perft question

Postby Zach Wegner » 19 Jan 2005, 00:47

No, they do not count.
User avatar
Zach Wegner
 
Posts: 182
Joined: 26 Sep 2004, 22:02
Location: Austin, Texas, USA

Re: perft question

Postby Reinhard Scharnagl » 19 Jan 2005, 00:49

Perft counts all VALID moves within a ply. A VALID mating move still is a move. Thus not all pseudolegal mating moves will be counted, only the LEGAL will be.

Reinhard.
Reinhard Scharnagl
 
Posts: 608
Joined: 01 Oct 2004, 08:36
Location: Klein-Gerau, Germany

Re: perft question

Postby Alessandro Scotti » 19 Jan 2005, 00:55

Sven Sch?le wrote:I have implemented perft for Surprise now, but my numbers are slightly different, and it seems to be related to mate positions.


Hi Sven,
note that Reinhard's statistics show the perft numbers classified per move type... very helpful for debugging!
User avatar
Alessandro Scotti
 
Posts: 306
Joined: 20 Nov 2004, 00:10
Location: Rome, Italy

Thank you

Postby Sven Schüle » 19 Jan 2005, 09:25

Hi all,

thank you for all of your replies :D . After correcting my perft function by not counting leaf nodes above MAX_DEPTH, I expect my perft numbers to be correct then (at least for the starting position, they are already correct with this change), I'll check it soon.

Hopefully there will be no reason for debugging my move generator in which I have much confidence and which did not show any legality problems within tournaments up to now. So it's probably only a matter of calculating perft numbers correctly.

Hi Reinhard,
Sven Sch?le wrote:Note that I mean the real perft number, not the total number of nodes visited.

Reinhard Scharnagl wrote:Perft counts all VALID moves within a ply. A VALID mating move still is a move. Thus not all pseudolegal mating moves will be counted, only the LEGAL will be.

of course you are right, but perhaps you have slightly misunderstood my question. Nevertheless - thank you for your hint!

Regards,
Sven
User avatar
Sven Schüle
 
Posts: 240
Joined: 26 Sep 2004, 20:19
Location: Berlin, Germany

Re: perft question

Postby Roman Hartmann » 20 Jan 2005, 11:49

Sven Sch?le wrote:Hi,

[snip]

I have the impression that such nodes do not count but I want to be sure. I have implemented perft for Surprise now, but my numbers are slightly different, and it seems to be related to mate positions.

Cheers,
Sven


Hi,
I had the same problem. The easiest solution is to implement a function that gives you the numbers of child moves. Sharper is an engine with that feature implemented (my own engine roce has that too). Just google for sharper.

output of roce in the starting position:
Code: Select all
roce: divide 4

g1h3 8881
g1f3 9748
b1c3 9755
b1a3 8885
h2h3 8457
h2h4 9329
g2g3 9345
g2g4 9328
f2f3 8457
f2f4 8929
e2e3 13134
e2e4 13160
d2d3 11959
d2d4 12435
c2c3 9272
c2c4 9744
b2b3 9345
b2b4 9332
a2a3 8457
a2a4 9329

Moves: 20
Nodes: 197281
roce:


with that feature bugs are quite easy to spot. In my case some of the EP moves did cause some troubles.

Roman
User avatar
Roman Hartmann
 
Posts: 155
Joined: 11 Oct 2004, 14:21


Return to Programming and Technical Discussions

Who is online

Users browsing this forum: No registered users and 5 guests

cron