Dann Corbit wrote:Wow! Perft 8 in under 2 minutes.
Perhaps I should stress that this is (mostly)
without making / unmaking the last ply, just generating moves and then lookig at the move-stack pointer to see how many there are. (That is what I mean by 'bulk counting'.) Only King moves and e.p. captures are actually made to check them for legality.
The version that is on my website now does not update a hash key during MakeMove(), as it seemed a bit unfair to require the update of a hash key if there is no hashing. It does test if it should update one, though (and if hashing is switched on, then immediately does the probe after update).
I considered not making the last ply a more meaningful speed measure for comparing with engines. In a search tree, there are two kind of end leaves: those where the evaluation is below alpha, (in which case you will do a move generation to get captures to try in QS), or where it is above beta (where in most cases you would not make the move to it, but prune it in the node below for futility). So the typical end leave does move or capture generation, and then comes to the conclusion that it doesn't want to make any of the generated moves, because they are all futile or bad captures.
So you typically end the tree with move generation, with 1 Make / Unmake per MoveGen for getting in the node, rather than ending with ~40 Make/Unmakes per MoveGen. A perft that makes the last ply thus puts way to much emphasis on the speed of the Make/Unmake, and far too little on the MoveGen itself.
But just out of curiosity, I included a compile-time switch in the perft (now posted as the source on the website, and also as
executable) that disables the bulk counting, but Makes/Unmakes all moves.
It seems that this approximately doubles the required time (from 5.6 to 12 sec for perft(6), on the 1GHz Athlon XP):
Code: Select all
$ ./mperft 6
- - - - - - - - - - - -
- - - - - - - - - - - -
- - r n b q k b n r - -
- - p p p p p p p p - -
- - . . . . . . . . - -
- - . . . . . . . . - -
- - . . . . . . . . - -
- - . . . . . . . . - -
- - P P P P P P P P - -
- - R N B Q K B N R - -
- - - - - - - - - - - -
- - - - - - - - - - - -
Quick Perft by H.G. Muller
Perft mode: No hashing, Making / UnMaking last ply
perft(1)=20 ( 0.000 sec)
perft(2)=400 ( 0.000 sec)
perft(3)=8902 ( 0.000 sec)
perft(4)=197281 ( 0.020 sec)
perft(5)=4865609 ( 0.480 sec)
perft(6)=119060324 (12.018 sec)
$ ./qperft 6
- - - - - - - - - - - -
- - - - - - - - - - - -
- - r n b q k b n r - -
- - p p p p p p p p - -
- - . . . . . . . . - -
- - . . . . . . . . - -
- - . . . . . . . . - -
- - . . . . . . . . - -
- - P P P P P P P P - -
- - R N B Q K B N R - -
- - - - - - - - - - - -
- - - - - - - - - - - -
Quick Perft by H.G. Muller
Perft mode: No hashing, bulk counting in horizon nodes
perft(1)=20 ( 0.000 sec)
perft(2)=400 ( 0.000 sec)
perft(3)=8902 ( 0.000 sec)
perft(4)=197281 ( 0.010 sec)
perft(5)=4865609 ( 0.220 sec)
perft(6)=119060324 ( 5.608 sec)