kiwipete perft position

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: kiwipete perft position

Post by Henk »

Robert Pope wrote:
Henk wrote:
hgm wrote:Kd7-d8 is not legal. There are only 6 King moves. And that makes a total of 15 (not 16). Which is OK, because each of the 3 Pawn moves also has 3 under-promotions, which makes 9 extra, for a total of 24.

Unfortunately qperft has no option to suppress under-promotion. But if Skipper does not do them, it is of course logical that you get lower counts for KiwiPete, as it is full of promotions.
Maybe they should split promotions into queen and under promotions when giving perft examples on these chess web sites. I think there will be more engines that don't support under promotions.
Or you could add promotions to your code. It's like 10 lines of code.
You don't know Skippers code. How many times modifications took days instead of only hours. I have a class for each piece (type, color) you know (so even a piece is not the same if it has same color and type). Also I don't know if play gets even worse. But if I would like to test many more perft tests I guess I have to change my Promotion class code.
Last edited by Henk on Thu Mar 26, 2015 3:18 pm, edited 1 time in total.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: kiwipete perft position

Post by Evert »

http://www.talkchess.com/forum/viewtopic.php?t=47318

Absolute best set of test positions for debugging a move generator. It'll tell you exactly where the problem is.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: kiwipete perft position

Post by bob »

Henk wrote:[d] r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1

In this position perft 4 should be 4085603. But Skipper computes 4074224.

Is 4085603 correct ?
Crafty v25.0 (1 cpus)

White(1): r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1
White(1): perft 4
total moves=4085603 time=0.15
White(1):
zullil
Posts: 6442
Joined: Tue Jan 09, 2007 12:31 am
Location: PA USA
Full name: Louis Zulli

Re: kiwipete perft position

Post by zullil »

bob wrote:
Henk wrote:[d] r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1

In this position perft 4 should be 4085603. But Skipper computes 4074224.

Is 4085603 correct ?
Crafty v25.0 (1 cpus)

White(1): r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1
White(1): perft 4
total moves=4085603 time=0.15
White(1):

Code: Select all

louis@LZsT5610:~/Documents/Chess/Kirby$ ./perft
FEN string = r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -
Depth = 4
Leaf nodes = 4085603
Time taken = 66 ms
My move generator is twice as fast as Crafty's on this position? :shock:
Clearly something is wrong with the universe. Or was Crafty running on an abacus here?

BTW, is v25.0 coming out soon? Thanks.
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: kiwipete perft position

Post by bob »

zullil wrote:
bob wrote:
Henk wrote:[d] r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1

In this position perft 4 should be 4085603. But Skipper computes 4074224.

Is 4085603 correct ?
Crafty v25.0 (1 cpus)

White(1): r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1
White(1): perft 4
total moves=4085603 time=0.15
White(1):

Code: Select all

louis@LZsT5610:~/Documents/Chess/Kirby$ ./perft
FEN string = r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -
Depth = 4
Leaf nodes = 4085603
Time taken = 66 ms
My move generator is twice as fast as Crafty's on this position? :shock:
Clearly something is wrong with the universe. Or was Crafty running on an abacus here?

BTW, is v25.0 coming out soon? Thanks.
It was running on my macbook while other things were running. My times are always elapsed time.. Here's a slightly different test:

White(1): r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w
White(1): perf
generated 184000000 moves, time=0.90 seconds
generated 204813328 moves per second
generated/made/unmade 184000000 moves, time=4.35 seconds
generated/made/unmade 42298108 moves per second
White(1):


The above just generates moves N times for the first part, then generates/makes/unmakes N times for the second. In looking at the code, N = 4,000,000 above, so 4M calls to the generator, and then 4M calls to movgen followed by a call to make/unmake for each move produced. I've never tried to make perft fast.

And yes, it will be out soon. Major changes everywhere to speed up SMP search, plus some eval and search changes as well...
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: kiwipete perft position

Post by Henk »

Robert Pope wrote:
Henk wrote:
hgm wrote:Kd7-d8 is not legal. There are only 6 King moves. And that makes a total of 15 (not 16). Which is OK, because each of the 3 Pawn moves also has 3 under-promotions, which makes 9 extra, for a total of 24.

Unfortunately qperft has no option to suppress under-promotion. But if Skipper does not do them, it is of course logical that you get lower counts for KiwiPete, as it is full of promotions.
Maybe they should split promotions into queen and under promotions when giving perft examples on these chess web sites. I think there will be more engines that don't support under promotions.
Or you could add promotions to your code. It's like 10 lines of code.
Implemented under promotion. But kiwipete perft position still not working. Change was at least 50-100 lines of code. So first have to implement perft divide. I now count 4066994 moves for perft(4).
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: kiwipete perft position

Post by hgm »

SO you must have implemented it wrong. Because the count Skipper gave for an under-promotion-less perft(4) (i.e. 4074224) was correct:

Code: Select all

C:\cygwin\home\perft>a -u 5 "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R
3K2R w KQkq -"
 - - - - - - - - - - - -
 - - - - - - - - - - - -
 - - r . . . k . . r - -
 - - p . p p q p b . - -
 - - b n . . p n p . - -
 - - . . . P N . . . - -
 - - . p . . P . . . - -
 - - . . N . . Q . p - -
 - - P P P B B P P P - -
 - - R . . . K . . R - -
 - - - - - - - - - - - -
 - - - - - - - - - - - -

Quick Perft by H.G. Muller
Perft mode: No hashing, bulk counting in horizon nodes

perft( 1)=           48 ( 0.000 sec)
perft( 2)=         2039 ( 0.001 sec)
perft( 3)=        97862 ( 0.001 sec)
perft( 4)=      4074224 ( 0.044 sec)
perft( 5)=    193301718 ( 1.834 sec)
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: kiwipete perft position

Post by Henk »

hgm wrote:SO you must have implemented it wrong. Because the count Skipper gave for an under-promotion-less perft(4) (i.e. 4074224) was correct:

Code: Select all

C:\cygwin\home\perft>a -u 5 "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R
3K2R w KQkq -"
 - - - - - - - - - - - -
 - - - - - - - - - - - -
 - - r . . . k . . r - -
 - - p . p p q p b . - -
 - - b n . . p n p . - -
 - - . . . P N . . . - -
 - - . p . . P . . . - -
 - - . . N . . Q . p - -
 - - P P P B B P P P - -
 - - R . . . K . . R - -
 - - - - - - - - - - - -
 - - - - - - - - - - - -

Quick Perft by H.G. Muller
Perft mode: No hashing, bulk counting in horizon nodes

perft( 1)=           48 ( 0.000 sec)
perft( 2)=         2039 ( 0.001 sec)
perft( 3)=        97862 ( 0.001 sec)
perft( 4)=      4074224 ( 0.044 sec)
perft( 5)=    193301718 ( 1.834 sec)
Yes my changes always give extra bugs.

My move iterator used to think that a capture always ends the search for one piece in one direction. But if a capture is a promotion there are now not one but instead four moves. So it should not go to the next direction until the last promotion move has been passed.
Henk
Posts: 7216
Joined: Mon May 27, 2013 10:31 am

Re: kiwipete perft position

Post by Henk »

Strangely Skipper gives perft(5) = 3605103 in position below, which should be correct

[d] n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1
brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 4:02 pm

Re: kiwipete perft position

Post by brtzsnr »

Correct

Code: Select all

$ ./perft --fen "n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1" --depth 5
Searching FEN "n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1"
depth        nodes   captures enpassant castles   promotions eval  KNps   elapsed
-----+------------+----------+---------+---------+----------+-----+------+-------
    5      3605103     754747         0         0     955220        4300 838.444046ms