Seeking perfts from root position

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Seeking perfts from root position

Post by mjlef »

I am running perfts on a new chess program I am writing, and it works fine up to perft 5, but perft 6 reports the wrong number of positions. Does anyone happen to have the peft 6 values fro each root move? That might help me track the bug down! Thanks.

Mark
Jacob

Re: Seeking perfts from root position

Post by Jacob »

H.G. Muller's perft program is very useful for this , it can split at any level. The Sharper website has some good test positions that catch many bugs.

Code: Select all

C:\>perft 7 -2 "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq -"
(the program throws an error if you include the fifty-move ply or move number :-/)

Code: Select all

perft(5)=             4865609 ( 0.047 sec)
2. h2h3 moves = 4463070
2. h2h4 moves = 5385554
2. g2g3 moves = 5346260
2. g2g4 moves = 5239875
2. f2f3 moves = 4404141
2. f2f4 moves = 4890429
2. e2e3 moves = 9726018
2. e2e4 moves = 9771632
2. d2d3 moves = 8073082
2. d2d4 moves = 8879566
2. c2c3 moves = 5417640
2. c2c4 moves = 5866666
2. b2b3 moves = 5310358
2. b2b4 moves = 5293555
2. a2a3 moves = 4463267
2. a2a4 moves = 5363555
2. g1f3 moves = 5723523
2. g1h3 moves = 4877234
2. b1a3 moves = 4856835
2. b1c3 moves = 5708064

perft(6)=           119060324 ( 1.484 sec)
2. h2h3 moves = 106678423
2. h2h4 moves = 138495290
2. g2g3 moves = 135987651
2. g2g4 moves = 130293018
2. f2f3 moves = 102021008
2. f2f4 moves = 119614841
2. e2e3 moves = 306138410
2. e2e4 moves = 309478263
2. d2d3 moves = 227598692
2. d2d4 moves = 269605599
2. c2c3 moves = 144074944
2. c2c4 moves = 157756443
2. b2b3 moves = 133233975
2. b2b4 moves = 134087476
2. a2a3 moves = 106743106
2. a2a4 moves = 137077337
2. g1f3 moves = 147678554
2. g1h3 moves = 120669525
2. b1a3 moves = 120142144
2. b1c3 moves = 148527161

perft(7)=          3195901860 (39.000 sec)
Good luck!
User avatar
hgm
Posts: 27793
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 :-/)
Sorry about that. :oops: I just stole the FEN-reading routine from Joker, which did not implement that, as Joker ignores the 50-move rule, and which was used only to pick FEN's from an internal array of test positions. But it should not crash on the number being present, just ignore it. I will look into it.

By the way, if you want to perft from the opening position, you would not have to give the FEN: it uses this position as default. So a simple

Code: Select all

perft 7 -2
should have given the same output.
tvrzsky
Posts: 128
Joined: Sat Sep 23, 2006 7:10 pm
Location: Prague

Re: Seeking perfts from root position

Post by tvrzsky »

Code: Select all

perft(7):           SubtreePerft        SubtreeInnerNodes
----------------------------------------------------------------------------------
01/20    Nb1-a3     120,142,144         5,064,713               1.63 s   3108.47 kN/s
02/20    Nb1-c3     148,527,161         5,952,936               3.51 s   3165.10 kN/s
03/20    Ng1-f3     147,678,554         5,967,223               5.39 s   3176.11 kN/s
04/20    Ng1-h3     120,669,525         5,085,038               6.98 s   3202.85 kN/s
05/20     a2-a3     106,743,106         4,653,171               8.43 s   3198.28 kN/s
06/20     a2-a4     137,077,337         5,591,157              10.21 s   3148.34 kN/s
07/20     b2-b3     133,233,975         5,535,399              11.96 s   3157.09 kN/s
08/20     b2-b4     134,087,476         5,519,474              13.71 s   3151.89 kN/s
09/20     c2-c3     144,074,944         5,650,214              15.55 s   3076.01 kN/s
10/20     c2-c4     157,756,443         6,116,954              17.55 s   3054.34 kN/s
11/20     d2-d3     227,598,692         8,414,112              20.30 s   3058.12 kN/s
12/20     d2-d4     269,605,599         9,254,372              23.42 s   2973.00 kN/s
13/20     e2-e3     306,138,410         10,142,760             26.83 s   2971.04 kN/s
14/20     e2-e4     309,478,263         10,190,798             30.30 s   2935.32 kN/s
15/20     f2-f3     102,021,008         4,591,888              31.74 s   3186.71 kN/s
16/20     f2-f4     119,614,841         5,098,253              33.37 s   3143.90 kN/s
17/20     g2-g3     135,987,651         5,573,256              35.16 s   3107.21 kN/s
18/20     g2-g4     130,293,018         5,463,693              36.91 s   3114.45 kN/s
19/20     h2-h3     106,678,423         4,652,972              38.38 s   3179.58 kN/s
20/20     h2-h4     138,495,290         5,614,153              40.17 s   3139.61 kN/s
----------------------------------------------------------------------------------
Total:   PERFT(7) = 3,195,901,860       124,132,536            40.17 s   3090.49 kN/s
mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Re: Seeking perfts from root position

Post by mjlef »

Thanks guys,

Don Dailey was able to get me perfts for all root moves up to perft 7. I fixed my perft 6 results, but perft 7 has some moves with slightly wrong counts. For what it is worth, my perft 6 problem was a bad number in an array to speed up knight attacks detection used in king in check testing. Just a simple typo.

Mark
User avatar
mclane
Posts: 18748
Joined: Thu Mar 09, 2006 6:40 pm
Location: US of Europe, germany
Full name: Thorsten Czub

Re: Seeking perfts from root position

Post by mclane »

please send don daily best wishes. a very nice guy !
Dann Corbit
Posts: 12540
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: Seeking perfts from root position

Post by Dann Corbit »

Movei output:

Code: Select all

new
perft 5
 a2a3  181046
  a2a4  217832
  b2b3  215255
  b2b4  216145
  c2c3  222861
  c2c4  240082
  d2d3  328511
  d2d4  361790
  e2e3  402988
  e2e4  405385
  f2f3  178889
  f2f4  198473
  g2g3  217210
  g2g4  214048
  h2h3  181044
  h2h4  218829
  b1a3  198572
  b1c3  234656
  g1f3  233491
  g1h3  198502
 perft(5) = 4865609,time=93
perft 6
 a2a3  4463267
  a2a4  5363555
  b2b3  5310358
  b2b4  5293555
  c2c3  5417640
  c2c4  5866666
  d2d3  8073082
  d2d4  8879566
  e2e3  9726018
  e2e4  9771632
  f2f3  4404141
  f2f4  4890429
  g2g3  5346260
  g2g4  5239875
  h2h3  4463070
  h2h4  5385554
  b1a3  4856835
  b1c3  5708064
  g1f3  5723523
  g1h3  4877234
 perft(6) = 119060324,time=1453
perft 7
 a2a3  106743106
  a2a4  137077337
  b2b3  133233975
  b2b4  134087476
  c2c3  144074944
  c2c4  157756443
  d2d3  227598692
  d2d4  269605599
  e2e3  306138410
  e2e4  309478263
  f2f3  102021008
  f2f4  119614841
  g2g3  135987651
  g2g4  130293018
  h2h3  106678423
  h2h4  138495290
  b1a3  120142144
  b1c3  148527161
  g1f3  147678554
  g1h3  120669525
 perft(7) = 3195901860,time=17641
perft 8
 b2b3  3579299617
  b2b4  3569067629
  g2g3  3641432923
  g2g4  3466204702
  d2d3  6093248619
  d2d4  7184581950
  f2f3  2728615868
  f2f4  3199039406
  h2h3  2860408680
  h2h4  3711123115
  a2a3  2863411653
  a2a4  3676309619
  c2c3  3806229124
  c2c4  4199667616
  e2e3  8039390919
  e2e4  8102108221
  b1a3  3193522577
  b1c3  3926684340
  g1f3  3937354096
  g1h3  3221278282
 perft(8) = 84998978956,time=261186
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Perft in SAN with single level splay

Post by sje »

Code: Select all

[] emp 5
Na3 198,572
Nc3 234,656
Nf3 233,491
Nh3 198,502
a3 181,046
a4 217,832
b3 215,255
b4 216,145
c3 222,861
c4 240,082
d3 328,511
d4 361,790
e3 402,988
e4 405,385
f3 178,889
f4 198,473
g3 217,210
g4 214,048
h3 181,044
h4 218,829
Pathway count to depth five: 4,865,609
[] emp 6
Na3 4,856,835
Nc3 5,708,064
Nf3 5,723,523
Nh3 4,877,234
a3 4,463,267
a4 5,363,555
b3 5,310,358
b4 5,293,555
c3 5,417,640
c4 5,866,666
d3 8,073,082
d4 8,879,566
e3 9,726,018
e4 9,771,632
f3 4,404,141
f4 4,890,429
g3 5,346,260
g4 5,239,875
h3 4,463,070
h4 5,385,554
Pathway count to depth six: 119,060,324
[] emp 7
Na3 120,142,144
Nc3 148,527,161
Nf3 147,678,554
Nh3 120,669,525
a3 106,743,106
a4 137,077,337
b3 133,233,975
b4 134,087,476
c3 144,074,944
c4 157,756,443
d3 227,598,692
d4 269,605,599
e3 306,138,410
e4 309,478,263
f3 102,021,008
f4 119,614,841
g3 135,987,651
g4 130,293,018
h3 106,678,423
h4 138,495,290
Pathway count to depth seven: 3,195,901,860
[] emp 8
Na3 3,193,522,577
Nc3 3,926,684,340
Nf3 3,937,354,096
Nh3 3,221,278,282
a3 2,863,411,653
a4 3,676,309,619
b3 3,579,299,617
b4 3,569,067,629
c3 3,806,229,124
c4 4,199,667,616
d3 6,093,248,619
d4 7,184,581,950
e3 8,039,390,919
e4 8,102,108,221
f3 2,728,615,868
f4 3,199,039,406
g3 3,641,432,923
g4 3,466,204,702
h3 2,860,408,680
h4 3,711,123,115
Pathway count to depth eight: 84,998,978,956
mjlef
Posts: 1494
Joined: Thu Mar 30, 2006 2:08 pm

Re: Perft in SAN with single level splay

Post by mjlef »

Thanks to everyone who supplied perfts. It is nice to see agreement!

I have all of perft 7 working except the counts for d2d3 and d2d4. Hopefully I will find that bug soon.

Mark
User avatar
Steve Maughan
Posts: 1221
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Perft in SAN with single level splay

Post by Steve Maughan »

Mark,

I'd recommend that once you get perft from the root working that you try other potential positions. Some themes to try are:
  • Pawn promotions
    Capturing pawn promotions
    Pawn promotions that give check with minor pieces
    Castling moves that give check
    En passant moves that are illegal due to discovered check
As an example of subtle problems, early versions of Monarch had a problem with the following position:

[D]8/4P3/2K5/8/4k3/8/8/8 w - -

The bug was that e8=R was not flagged as a check since the pawn was not removed before the check detection routine was called - optimization, the root of all bugs!!

Happy perfing,

Steve