Seeking perfts from root position

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Roman Hartmann
Posts: 295
Joined: Wed Mar 08, 2006 8:29 pm

Re: Seeking perfts from root position

Post by Roman Hartmann »

Jacob wrote:Had I a dime for each little mistake I've made, I could buy myself my own computer >_<.

Sure, it'd be fun to look through the source of the hashing versions. There used to be a site that listed perft values for several positions along with check counts, captures, e.p., etc. and it was very useful for debugging. Unfortunately it seems to be gone now, but if you combine the versions I could use it to validate my results, and I'd make a web page of my own.
I know which site you have in mind. It can still be found in the archives.
Anyway, if you only need some position and the corresponding perft values you might want to have a look at this site: http://mypage.bluewin.ch/romanhartmann/perft.html

There is a a testsuite (this testsuite is from Andrew Wagner originally) on the site with fen-strings and the proper perft numbers up to depth 6 (it's a text-file): http://mypage.bluewin.ch/romanhartmann/perftsuite.epd

best regards
Roman
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Seeking perfts from root position

Post by hgm »

Jacob wrote:Had I a dime for each little mistake I've made, I could buy myself my own computer >_<.

Sure, it'd be fun to look through the source of the hashing versions. There used to be a site that listed perft values for several positions along with check counts, captures, e.p., etc. and it was very useful for debugging. Unfortunately it seems to be gone now, but if you combine the versions I could use it to validate my results, and I'd make a web page of my own.
Yes, this was the SMIRF website. I verified all my perfts against that, also the move-type specifications (except that my perft did not report checks and mates).

OK, I put a version with hash on my website, now, and it seems to work. I use the full 64 bits of the key, so although key collisions are possible in theory, they should be very unlikely. The opening perfts seem to be OK upto d=8. (I did not test deeper.) Hashing with a reasonable size table (say 128MB) speeds up the perft(7) by more than a factor 5 (53 sec to 9.6 sec on a 2.8GHz Pentium IV).

Funny thing is that I started using a very simplistic hashing scheme, (replace always) with the aim to first achieve correctness first, before optimizing, and then it turned out I could hardly improve on it by smarter replacement.

So it still uses replace always. Depth does not provide upward compatibility for perfting, so I just work the depth into the key. The same position can then be in the table several times, with different depth. As a consequence I don't have to store the depth in the entry, except for implementing things as depth-preferred replacement. So I decided not to bother.

There is some implicit depth-prefference, though: The d=1 nodes (which count the moves to determine how many d=0 nodes there would be, but except for a few exceptions were legality checking was difficult otherwise, it does not really make these moves) can be calculated so fast, that probing the main hash for them is actually counterproductive. The average DRAM access takes far longer than running the move generator. So I have a separate small hash table, of only 128KB (8K entries) that is so frequently probed that it will always remain in L2 (which was 512KB on my machine). All d=1 probes go there, and as they are always L2 hits, this really pays off (despite the lower hash hit rate).

The lowest depth to go into the main hash is thus d=2. I confined these probes to half the hash table (the odd entries), to protect the deeper stuff that goes all into the other half. Trying to give d=4 or d=5 more protection than d=3 did not seem to speed things up.

If you find any errors, let me know. :roll:
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Seeking perfts from root position

Post by hgm »

OK, it turned out there still was a problem with promotions, but that is fixed now.

If you want to see even a (long long int) overflow, try

perft 24 H25 "8/3k4/3p4/8/3P4/3K4/8/8 b - - 0 1" :lol: :lol: :lol:
Uri Blass
Posts: 10282
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Seeking perfts from root position

Post by Uri Blass »

What is the solution of perft(20) perft(21) perft(22) perft(23) perft(24)

perft 24 H25 "8/3k4/3p4/8/3P4/3K4/8/8 b - - 0 1"

I got
perft(20)=58,904,461,091,926,399
perft(22)=82872255874756873(d5)+474297542664417126(d7e7)+
354739845067632686(d7c7)+ 295250444129894126(d7d8)+335327397335337239(d7e8)+435497702083036490(d7e6)+262008520520999121(d7c8)+318839649819940741(d7c6)=
2,558,833,357,496,014,402

Uri
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Seeking perfts from root position

Post by hgm »

perft(20)=58904461091926399 ( 0.594 sec)

perft(21)=381979333998829809 ( 1.250 sec)

perft(22)=2558833357496014402 ( 1.953 sec)

perft(23)=-1825104488615836100 ( 3.281 sec)

perft(24)=384527884980177764 ( 4.797 sec)
from 23 on it overflows.
Uri Blass
Posts: 10282
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Seeking perfts from root position

Post by Uri Blass »

hgm wrote:
perft(20)=58904461091926399 ( 0.594 sec)

perft(21)=381979333998829809 ( 1.250 sec)

perft(22)=2558833357496014402 ( 1.953 sec)

perft(23)=-1825104488615836100 ( 3.281 sec)

perft(24)=384527884980177764 ( 4.797 sec)
from 23 on it overflows.
Movei does not do it so fast and probably needs more than an hour for perft 24

The reason is probably the fact that I store in the hash only integers and if perft is too high I do not store it in the hash assuming that the number of cases when it is going to happen is small.

Uri