Code: Select all
"W:B1,2,3,4,5,6,7,8,9,10,11,12:W21,22,23,24,25,26,27,28,29,30,31,32"
Searching to nominal depth=22
perft( 1) 7 nodes, 0.00s, 7.00 Mnps
perft( 2) 49 nodes, 0.00s, 49.00 Mnps
perft( 3) 302 nodes, 0.00s, 302.00 Mnps
perft( 4) 1469 nodes, 0.00s, 1469.00 Mnps
perft( 5) 7361 nodes, 0.00s, 7361.00 Mnps
perft( 6) 36768 nodes, 0.00s, 36768.00 Mnps
perft( 7) 179740 nodes, 0.00s, 179740.00 Mnps
perft( 8) 845931 nodes, 0.01s, 84.58 Mnps
perft( 9) 3963680 nodes, 0.06s, 66.06 Mnps
perft(10) 18391564 nodes, 0.18s, 102.17 Mnps
perft(11) 85242128 nodes, 0.50s, 170.48 Mnps
perft(12) 388623673 nodes, 1.53s, 254.00 Mnps
perft(13) 1766623630 nodes, 4.98s, 354.74 Mnps
perft(14) 7978439499 nodes, 14.68s, 543.49 Mnps
perft(15) 36263167175 nodes, 45.69s, 793.68 Mnps
perft(16) 165629569428 nodes, 149.60s, 1107.15 Mnps
perft(17) 758818810990 nodes, 522.30s, 1452.84 Mnps
perft(18) 3493881706141 nodes, 1851.01s, 1887.55 Mnps
perft(19) 16114043592799 nodes, 6465.48s, 2492.32 Mnps
perft(20) 74545030871553 nodes, 22457.55s, 3319.38 Mnps
perft(21) 345100524480819 nodes, 77763.22s, 4437.84 Mnps
perft(22) 1602372721738102 nodes, 273469.14s, 5859.43 Mnps
End of program.
I've instrumented my perft code with a 1Gb hash table that keeps track of the search depth and the node count. Total hash entry size is 16 bytes so that gives 64M entries. The table is organized into 64 byte buckets of 4 entries each for cache alignment purposes. I use a simple "shallowest of 4" replacement scheme when a bucket is full. I also use the "undercut" refinement of H.G. Muller to replace the primary hash entry of a bucket (if old depth == new depth - 1).
This scheme speeds up the perft count tremendously. At depth = 22, the branching factor is reduced from 4.6 (in terms of nodes) to 3.5 (in terms of seconds). The perft(22) computation took a little over 3 days on my 3.2 GHz P4 (64-bit Linux, Intel C++ compiler).
Because I use hashing, there is always the chance that I had hard collisions (i.e. different positions mapping to the same 64-bit number). Since there are about 2^64=1.6e19 hash keys, the birthday paradox would predict roughly one error in every 2^32=4e9 positions. I haven't counted yet the number of hash stores, but because perft(21) is correctly reproduces, I have some hopes that perft(22) is also correct. However, any confirmation is welcome!