Seeking perfts from root position

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: Perft in SAN with single level splay

Post by hgm »

Note that you can split the deeper moves as well, or give a FEN argument to start from the position after d2d3 and d2d4. For the perft this is OK.

For the engine with gives the wrong perft, it doesn't always work. When developing Joker I had an infuriating bug which would cause a wrong perft count for a certain move, but the correct perft count when I started from the position after the move. Then you really have to do deeper splits in the engine. This is only feasible upto d=4 or so, before you are swamped with data. The solution is a onditional deep split in the engine, that only prints if the first N moves in the path are equal to a given path. With that you track down the error in no time.

Note that from the opening upto d=6 you have no castlings, and upto d=8 no promotions, so for detecting errors in the handling of those it is better to use other positions.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Perft in SAN with single level splay

Post by sje »

Code: Select all

[] emp 9
Na3 85,849,641,909
Nc3 109,418,317,145
Nf3 108,393,009,416
Nh3 86,659,653,631
a3 74,950,758,099
a4 101,265,301,849
b3 96,577,095,997
b4 97,442,160,946
c3 108,697,368,719
c4 120,549,219,832
d3 176,976,245,463
d4 227,220,482,342
e3 259,522,947,791
e4 263,561,543,780
f3 68,094,899,093
f4 84,792,070,664
g3 99,646,370,024
g4 92,281,289,941
h3 74,778,417,365
h4 102,853,440,161
Pathway count to depth nine: 2,439,530,234,167
mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Re: Perft in SAN with single level splay

Post by mjlef »

I have perft 8 working fine and verified. I would like to test some promotion conditions though, and a perft 9 is not very practical, timewise. Does anyone have perfts for positions leading to promotion in a resonable number of moves?
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Perft in SAN with single level splay

Post by hgm »

If you would just download the perft, you would not be dependent on anyone calculating them for you for any position... :?
User avatar
hgm
Posts: 27808
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:(the program throws an error if you include the fifty-move ply or move number :-/)
OK, I fixed this. The move counts are now simply ignored.

It is now also possible to give an e.p. square in the FEN.

The FEN parsing is extremely uncritical in the tail of the FEN, (e.g. it would accept "k7/8/8/8/8/8/8/7K K7-- 89Qe6928kw-k" as if it meant "k7/8/8/8/8/8/8/7K w KQk e6 0 0"), but that should make it understand all legal FENs properly.

I also fixed the problem with printing of long long int that existed on some platforms, by using lltoa() in stead of the %lld printf format.

It is now also downloadable as a Windows executable.
Jacob

Re: Seeking perfts from root position

Post by Jacob »

OK, I fixed this. The move counts are now simply ignored.

It is now also possible to give an e.p. square in the FEN.
Works great =). Your program has been very useful to me in debugging my move generators, thanks.

Here's a really good position, currently working on depth 6 for you: r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -

Code: Select all

r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -

perft(1)=48 ( 0.000 sec)

2. e1g1 moves = 43
2. e1c1 moves = 43
2. g2h3 moves = 43
2. g2g3 moves = 42
2. g2g4 moves = 42
2. b2b3 moves = 42
2. a2a3 moves = 44
2. a2a4 moves = 44
2. d5e6 moves = 46
2. d5d6 moves = 41
2. c3a4 moves = 42
2. c3b5 moves = 39
2. c3d1 moves = 42
2. c3b1 moves = 42
2. e5c6 moves = 41
2. e5d7 moves = 45
2. e5f7 moves = 44
2. e5g6 moves = 42
2. e5g4 moves = 44
2. e5d3 moves = 43
2. e5c4 moves = 42
2. f3g3 moves = 43
2. f3h3 moves = 43
2. f3e3 moves = 43
2. f3d3 moves = 42
2. f3f4 moves = 43
2. f3f5 moves = 45
2. f3f6 moves = 39
2. f3g4 moves = 43
2. f3h5 moves = 43
2. d2e3 moves = 43
2. d2f4 moves = 43
2. d2g5 moves = 42
2. d2h6 moves = 41
2. d2c1 moves = 43
2. e2d3 moves = 42
2. e2c4 moves = 41
2. e2b5 moves = 39
2. e2a6 moves = 36
2. e2f1 moves = 44
2. e2d1 moves = 44
2. a1b1 moves = 43
2. a1c1 moves = 43
2. a1d1 moves = 43
2. h1g1 moves = 43
2. h1f1 moves = 43
2. e1f1 moves = 43
2. e1d1 moves = 43
perft(2)=2039 ( 0.000 sec)

2. e1g1 moves = 2059
2. e1c1 moves = 1887
2. g2h3 moves = 1970
2. g2g3 moves = 1882
2. g2g4 moves = 1843
2. b2b3 moves = 1964
2. a2a3 moves = 2186
2. a2a4 moves = 2149
2. d5e6 moves = 2241
2. d5d6 moves = 1991
2. c3a4 moves = 2203
2. c3b5 moves = 2138
2. c3d1 moves = 2040
2. c3b1 moves = 2038
2. e5c6 moves = 2027
2. e5d7 moves = 2124
2. e5f7 moves = 2080
2. e5g6 moves = 1997
2. e5g4 moves = 1878
2. e5d3 moves = 1803
2. e5c4 moves = 1880
2. f3g3 moves = 2214
2. f3h3 moves = 2360
2. f3e3 moves = 2174
2. f3d3 moves = 2005
2. f3f4 moves = 2132
2. f3f5 moves = 2396
2. f3f6 moves = 2111
2. f3g4 moves = 2169
2. f3h5 moves = 2267
2. d2e3 moves = 2136
2. d2f4 moves = 2000
2. d2g5 moves = 2134
2. d2h6 moves = 2019
2. d2c1 moves = 1963
2. e2d3 moves = 2050
2. e2c4 moves = 2082
2. e2b5 moves = 2057
2. e2a6 moves = 1907
2. e2f1 moves = 2060
2. e2d1 moves = 1733
2. a1b1 moves = 1969
2. a1c1 moves = 1968
2. a1d1 moves = 1885
2. h1g1 moves = 2013
2. h1f1 moves = 1929
2. e1f1 moves = 1855
2. e1d1 moves = 1894
perft(3)=97862 ( 0.015 sec)

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

2. e1g1 moves = 4119629
2. e1c1 moves = 3551583
2. g2h3 moves = 3819456
2. g2g3 moves = 3472039
2. g2g4 moves = 3338154
2. b2b3 moves = 3768824
2. a2a3 moves = 4627439
2. a2a4 moves = 4387586
2. d5e6 moves = 4727437
2. d5d6 moves = 3835265
2. c3a4 moves = 4628497
2. c3b5 moves = 4317482
2. c3d1 moves = 3995761
2. c3b1 moves = 3996171
2. e5c6 moves = 4083458
2. e5d7 moves = 4404043
2. e5f7 moves = 4164923
2. e5g6 moves = 3949417
2. e5g4 moves = 3415992
2. e5d3 moves = 3288812
2. e5c4 moves = 3494887
2. f3g3 moves = 4669768
2. f3h3 moves = 5067173
2. f3e3 moves = 4477772
2. f3d3 moves = 3949570
2. f3f4 moves = 4327936
2. f3f5 moves = 5271134
2. f3f6 moves = 3975992
2. f3g4 moves = 4514010
2. f3h5 moves = 4743335
2. d2e3 moves = 4407041
2. d2f4 moves = 3941257
2. d2g5 moves = 4370915
2. d2h6 moves = 3967365
2. d2c1 moves = 3793390
2. e2d3 moves = 4066966
2. e2c4 moves = 4182989
2. e2b5 moves = 4032348
2. e2a6 moves = 3553501
2. e2f1 moves = 4095479
2. e2d1 moves = 3074219
2. a1b1 moves = 3827454
2. a1c1 moves = 3814203
2. a1d1 moves = 3568344
2. h1g1 moves = 3989454
2. h1f1 moves = 3685756
2. e1f1 moves = 3377351
2. e1d1 moves = 3559113
perft(5)=193690690 ( 2.718 sec)

2. e1g1 moves = 172063416
2. e1c1 moves = 148701308
2. g2h3 moves = 158328615
2. g2g3 moves = 141076301
2. g2g4 moves = 135208177
2. b2b3 moves = 153953689
2. a2a3 moves = 197413067
2. a2a4 moves = 183872225
2. d5e6 moves = 203255191
2. d5d6 moves = 151133066
2. c3a4 moves = 191260040
2. c3b5 moves = 166970874
2. c3d1 moves = 165415976
2. c3b1 moves = 165673862
2. e5c6 moves = 169836097
2. e5d7 moves = 193856446
2. e5f7 moves = 176070755
2. e5g6 moves = 165477768
2. e5g4 moves = 144264874
2. e5d3 moves = 140737072
2. e5c4 moves = 145182844
2. f3g3 moves = 198078522
2. f3h3 moves = 210100865
2. f3e3 moves = 189120807
2. f3d3 moves = 164583144
2. f3f4 moves = 181938761
2. f3f5 moves = 226135507
2. f3f6 moves = 146338070
2. f3g4 moves = 189789456
2. f3h5 moves = 197839051
2. d2e3 moves = 184114087
2. d2f4 moves = 165805784
2. d2g5 moves = 177883051
2. d2h6 moves = 161319567
2. d2c1 moves = 158801466
2. e2d3 moves = 167737155
2. e2c4 moves = 170094798
2. e2b5 moves = 158033152
2. e2a6 moves = 130642863
2. e2f1 moves = 174218453
2. e2d1 moves = 131348645
2. a1b1 moves = 160413321
2. a1c1 moves = 159720218
2. a1d1 moves = 149265033
2. h1g1 moves = 166086672
2. h1f1 moves = 154273720
2. e1f1 moves = 139601450
2. e1d1 moves = 148612404
perft(6)=8031647685 (122.625 sec)
This one helped me detect some obscure e.p. bugs: 8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - -
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Seeking perfts from root position

Post by hgm »

Yes, that position is quite famous, and known as KiwiPete (for reasons not known to me). In a version of my perft with hashing I could verify it to depth 7 (including breakdown into captures, castlings, promotions etc.).
Jacob

Re: Seeking perfts from root position

Post by Jacob »

Interesting name. KiwiPete is an ICC handle, and also a CCC user name for Peter McKenzie (the wonders of Google search :D), so I'd venture a guess he's the composer of the position,...

The windows executable for QuickPerft is no longer handling the side to move tag correctly.

Code: Select all

r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R4RK1 b kq -

perft(1)=48 ( 0.000 sec)

2. g2h3 moves = 43
2. g2g3 moves = 42
2. g2g4 moves = 42
2. b2b3 moves = 42
2. a2a3 moves = 44
2. a2a4 moves = 44
2. d5e6 moves = 46
2. d5d6 moves = 41
2. c3a4 moves = 42
2. c3b5 moves = 39
2. c3d1 moves = 42
2. c3b1 moves = 42
2. e5c6 moves = 41
2. e5d7 moves = 45
2. e5f7 moves = 44
2. e5g6 moves = 42
2. e5g4 moves = 44
2. e5d3 moves = 43
2. e5c4 moves = 42
2. f3g3 moves = 43
2. f3h3 moves = 43
2. f3e3 moves = 43
2. f3d3 moves = 42
2. f3f4 moves = 43
2. f3f5 moves = 45
2. f3f6 moves = 39
2. f3g4 moves = 43
2. f3h5 moves = 43
2. d2e1 moves = 43
2. d2e3 moves = 43
2. d2f4 moves = 43
2. d2g5 moves = 42
2. d2h6 moves = 41
2. d2c1 moves = 43
2. e2d3 moves = 42
2. e2c4 moves = 41
2. e2b5 moves = 39
2. e2a6 moves = 36
2. e2d1 moves = 44
2. a1b1 moves = 43
2. a1c1 moves = 43
2. a1d1 moves = 43
2. a1e1 moves = 43
2. f1e1 moves = 43
2. f1d1 moves = 43
2. f1c1 moves = 43
2. f1b1 moves = 43
2. g1h1 moves = 43
perft(2)=2038 ( 0.015 sec)

Is generating white moves for black to move :-/
User avatar
hgm
Posts: 27808
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, I fixed it.

To read the e.p. square I intercepted all characters between 'a' and 'h', as I thought that all other valid characters were outside this range. But I overlooked the 'b' for black. :oops:

Perhaps I should combine this version with the (slower) version that does not simply count the total number of moves from the length of the move list, but actually goes through the move list to classify each move as (non)capture, promotion, castling, etc., and report the corresponding numbers. A flag argument -S could then select the elaborate version.

I could also make the versions that do hashing available.
Jacob

Re: Seeking perfts from root position

Post by Jacob »

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.