kiwipete perft position

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Henk
Posts: 5799
Joined: Mon May 27, 2013 8:31 am

Re: kiwipete perft position

Post by Henk » Sat Mar 28, 2015 12:41 pm

Skipper computes perft(4) = 3504849 without castling rights. Which should be ok too.

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

brtzsnr
Posts: 433
Joined: Fri Jan 16, 2015 3:02 pm
Contact:

Re: kiwipete perft position

Post by brtzsnr » Sat Mar 28, 2015 12:52 pm

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 ?
It looks like a tree explosion after depth 4. If this helps:

Code: Select all

$ ./perft --fen "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1" --max_depth 5
Searching FEN "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1"
depth        nodes   captures enpassant castles   promotions eval  KNps   elapsed
-----+------------+----------+---------+---------+----------+-----+------+-------
    1           48          8         0         2          0         280 171.384µs
    2         2039        351         1        91          0         178 11.467837ms
    3        97862      17102        45      3162          0         133 736.178077ms
    4      4085603     757163      1929    128013      15172        3263 1.252207204s
    5    193690690   35043416     73365   4993637       8392        3554 54.496018026s


Robert Pope
Posts: 510
Joined: Sat Mar 25, 2006 7:27 pm

Re: kiwipete perft position

Post by Robert Pope » Sat Mar 28, 2015 1:03 pm

Have you implemented a 'divide' command? Once you have that, it's pretty straightforward to drill down until you can see the issue at perft(1), comparing to a correct engine that also has divide (like sharper).

Henk
Posts: 5799
Joined: Mon May 27, 2013 8:31 am

Re: kiwipete perft position

Post by Henk » Sat Mar 28, 2015 1:09 pm

Robert Pope wrote:Have you implemented a 'divide' command? Once you have that, it's pretty straightforward to drill down until you can see the issue at perft(1), comparing to a correct engine that also has divide (like sharper).
No. I first have to implement a perft divide otherwise I keep guessing.

My guess is that is has something to do with castling and promotion. Perhaps after castling the promoting pawn is blocked but still can capture the rook and promote in four different ways?? Who knows.

Robert Pope
Posts: 510
Joined: Sat Mar 25, 2006 7:27 pm

Re: kiwipete perft position

Post by Robert Pope » Sat Mar 28, 2015 1:43 pm

You never know until you do it.

Once, I coded the ep square as zero when no ep capture was possible. But then my engine thought b2-a1 was an ep capture, so it would move diagonally into an empty square and promote.

You just can't predict the cause of half the bugs you run across. But once you have perft exhaustively tested, it gives you some peace of mind.

zullil
Posts: 5606
Joined: Mon Jan 08, 2007 11:31 pm
Location: PA USA
Full name: Louis Zulli

Re: kiwipete perft position

Post by zullil » Sat Mar 28, 2015 2:39 pm

Henk wrote:Skipper computes perft(4) = 3504849 without castling rights. Which should be ok too.

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

Code: Select all

ProcyonLeo: ~/Documents/Chess/Kirby] ./perft
FEN string = r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w - -
Depth = 4
Leaf nodes = 3504849
Time taken = 74 ms

Henk
Posts: 5799
Joined: Mon May 27, 2013 8:31 am

Re: kiwipete perft position

Post by Henk » Sat Mar 28, 2015 4:54 pm

hgm wrote:

Code: Select all

C:\cygwin\home\perft>perft 6 "n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1"
 - - - - - - - - - - - -
 - - - - - - - - - - - -
 - - n . n . . . . . - -
 - - P P P k . . . . - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - . . . . . . . . - -
 - - . . . . K p p p - -
 - - . . . . . N . N - -
 - - - - - - - - - - - -
 - - - - - - - - - - - -

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

perft( 1)=           24 ( 0.000 sec)
perft( 2)=          496 ( 0.000 sec)
perft( 3)=         9483 ( 0.001 sec)
perft( 4)=       182838 ( 0.004 sec)
perft( 5)=      3605103 ( 0.080 sec)
perft( 6)=     71179139 ( 1.570 sec)
KiwiPete:

Code: Select all

2. e1g1 moves =      86975 ( 0.000 sec)
2. e1c1 moves =      79803 ( 0.000 sec)
2. g2h3 moves =      82759 ( 0.000 sec)
2. g2g3 moves =      77468 ( 0.000 sec)
2. g2g4 moves =      75677 ( 0.000 sec)
2. b2b3 moves =      81066 ( 0.000 sec)
2. a2a3 moves =      94405 ( 0.015 sec)
2. a2a4 moves =      90978 ( 0.000 sec)
2. d5e6 moves =      97464 ( 0.000 sec)
2. d5d6 moves =      79551 ( 0.000 sec)
2. c3a4 moves =      91447 ( 0.000 sec)
2. c3b5 moves =      81498 ( 0.000 sec)
2. c3d1 moves =      84782 ( 0.000 sec)
2. c3b1 moves =      84773 ( 0.000 sec)
2. e5c6 moves =      83885 ( 0.000 sec)
2. e5d7 moves =      93913 ( 0.000 sec)
2. e5f7 moves =      88799 ( 0.000 sec)
2. e5g6 moves =      83866 ( 0.000 sec)
2. e5g4 moves =      79912 ( 0.016 sec)
2. e5d3 moves =      77431 ( 0.000 sec)
2. e5c4 moves =      77752 ( 0.000 sec)
2. f3g3 moves =      94461 ( 0.000 sec)
2. f3h3 moves =      98524 ( 0.000 sec)
2. f3e3 moves =      92505 ( 0.000 sec)
2. f3d3 moves =      83727 ( 0.000 sec)
2. f3f4 moves =      90488 ( 0.000 sec)
2. f3f5 moves =     104992 ( 0.000 sec)
2. f3f6 moves =      77838 ( 0.000 sec)
2. f3g4 moves =      92037 ( 0.000 sec)
2. f3h5 moves =      95034 ( 0.000 sec)
2. d2e3 moves =      90274 ( 0.000 sec)
2. d2f4 moves =      84869 ( 0.016 sec)
2. d2g5 moves =      87951 ( 0.000 sec)
2. d2h6 moves =      82323 ( 0.000 sec)
2. d2c1 moves =      83037 ( 0.000 sec)
2. e2d3 moves =      85119 ( 0.000 sec)
2. e2c4 moves =      84835 ( 0.000 sec)
2. e2b5 moves =      79739 ( 0.000 sec)
2. e2a6 moves =      69334 ( 0.000 sec)
2. e2f1 moves =      88728 ( 0.000 sec)
2. e2d1 moves =      74963 ( 0.000 sec)
2. a1b1 moves =      83348 ( 0.000 sec)
2. a1c1 moves =      83263 ( 0.000 sec)
2. a1d1 moves =      79695 ( 0.015 sec)
2. h1g1 moves =      84876 ( 0.000 sec)
2. h1f1 moves =      81563 ( 0.000 sec)
2. e1f1 moves =      77887 ( 0.000 sec)
2. e1d1 moves =      79989 ( 0.000 sec)
perft( 4)=      4085603 ( 0.062 sec)
without castling rights:

Code: Select all

C:\cygwin\home\perft>perft 5 "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/
R3K2R w - - 0 1"
 - - - - - - - - - - - -
 - - - - - - - - - - - -
 - - 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)=           46 ( 0.000 sec)
perft( 2)=         1866 ( 0.000 sec)
perft( 3)=        86677 ( 0.000 sec)
perft( 4)=      3504849 ( 0.031 sec)
perft( 5)=    161724713 ( 1.204 sec)
Already after a2-a3 skipper gives 93979 which should be 94405. What should be the correct perft(3) divide after a2-a3. So I can trace what's going wrong ?

[d] r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/P1N2Q1p/1PPBBPPP/R3K2R b KQkq - 0 1

Or isn't there a website where I can compute a perft divide for a fen ?

syzygy
Posts: 4450
Joined: Tue Feb 28, 2012 10:56 pm

Re: kiwipete perft position

Post by syzygy » Sat Mar 28, 2015 5:29 pm

Just use Stockfish?

$ ./stockfish
Stockfish 260315 64 POPCNT by Tord Romstad, Marco Costalba and Joona Kiiski
position fen r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/P1N2Q1p/1PPBBPPP/R3K2R b KQkq - 0 1
perft 3

Position: 1/1
b4b3: 2133
g6g5: 2125
c7c6: 2212
d7d6: 2135
c7c5: 2112
h3g2: 2495
b4a3: 2215
e6d5: 2219
b4c3: 2125
b6a4: 2121
b6c4: 2133
b6d5: 2065
b6c8: 1872
f6e4: 2717
f6g4: 2415
f6d5: 2323
f6h5: 2277
f6h7: 2179
f6g8: 2180
g7h6: 2204
g7f8: 1972
a6e2: 1995
a6d3: 2171
a6c4: 2182
a6b5: 2225
a6b7: 2186
a6c8: 1888
a8b8: 2222
a8c8: 2073
a8d8: 2075
h8h4: 2211
h8h5: 2171
h8h6: 2021
h8h7: 2022
h8f8: 1825
h8g8: 1923
e7c5: 2560
e7d6: 2243
e7d8: 2018
e7f8: 2014
e8d8: 2040
e8f8: 1997
e8g8: 2024
e8c8: 2090

===========================
Total time (ms) : 3
Nodes searched : 94405
Nodes/second : 31468333

Henk
Posts: 5799
Joined: Mon May 27, 2013 8:31 am

Re: kiwipete perft position

Post by Henk » Sat Mar 28, 2015 5:49 pm

Ok I have stockfish_14053109_x64_modern.exe.

I started it. It computes perft. But no perft divide.

Henk
Posts: 5799
Joined: Mon May 27, 2013 8:31 am

Re: kiwipete perft position

Post by Henk » Sat Mar 28, 2015 6:15 pm

syzygy wrote:Just use Stockfish?

$ ./stockfish
Stockfish 260315 64 POPCNT by Tord Romstad, Marco Costalba and Joona Kiiski
position fen r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/P1N2Q1p/1PPBBPPP/R3K2R b KQkq - 0 1
perft 3

Position: 1/1
b4b3: 2133
g6g5: 2125
c7c6: 2212
d7d6: 2135
c7c5: 2112
h3g2: 2495
b4a3: 2215
e6d5: 2219
b4c3: 2125
b6a4: 2121
b6c4: 2133
b6d5: 2065
b6c8: 1872
f6e4: 2717
f6g4: 2415
f6d5: 2323
f6h5: 2277
f6h7: 2179
f6g8: 2180
g7h6: 2204
g7f8: 1972
a6e2: 1995
a6d3: 2171
a6c4: 2182
a6b5: 2225
a6b7: 2186
a6c8: 1888
a8b8: 2222
a8c8: 2073
a8d8: 2075
h8h4: 2211
h8h5: 2171
h8h6: 2021
h8h7: 2022
h8f8: 1825
h8g8: 1923
e7c5: 2560
e7d6: 2243
e7d8: 2018
e7f8: 2014
e8d8: 2040
e8f8: 1997
e8g8: 2024
e8c8: 2090

===========================
Total time (ms) : 3
Nodes searched : 94405
Nodes/second : 31468333
This sub problem has been solved now. I gave first two black rooks the wrong number for the eight rooks for under promotion were created first. Castling rights are dependent on rook number in Skipper. Only the rooks with number 1 en 2 have possible castling rights in Skipper.

Post Reply