You gotta love Perft... just not too much!
Moderators: hgm, Rebel, chrisw
-
- Posts: 69
- Joined: Thu Nov 21, 2013 12:37 am
- Location: Manchester, UK
- Full name: Martin Bryant
You gotta love Perft... just not too much!
Whilst re-writing Colossus to use bitboards I obviously used Perft to try to verify the correctness of the new move generators etc, mainly using the positions and results given here...
https://www.chessprogramming.org/Perft_Results
I have automated the testing now and I re-run them every so often just to get a warm, cosy glow
In fact, I was so warm and cosy that I would have bet a large sum of money that the move-generators were now bug free!
However, last night I stumbled across this remarkable mate in 89!
viewtopic.php?f=2&t=70695&p=798285&hili ... in#p798285
Just for fun I put it into Colossus... but was shocked to see it announce a mate in 8!
I stepped through it's PV to get to here...
[d]8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
...which Colossus thought was a mate in 1 (Qf1+)! OOPS!!
So, it turns out that there WAS still a bug in one of my 'generate-moves-out-of-check' routines but it only occurred when a BLACK PROMOTING pawn (it would have worked for white in a mirrored position or shifted one rank north) was blocking the rayed check... boy oh boy... glad I didn't make any bets! Humbling to accept that searching hundreds of billions of positions doesn't necessarily drive your code through all paths!
Perhaps someone with editing permissions would like to add this to the wiki page if they consider it worthy of note?
https://www.chessprogramming.org/Perft_Results
I have automated the testing now and I re-run them every so often just to get a warm, cosy glow
In fact, I was so warm and cosy that I would have bet a large sum of money that the move-generators were now bug free!
However, last night I stumbled across this remarkable mate in 89!
viewtopic.php?f=2&t=70695&p=798285&hili ... in#p798285
Just for fun I put it into Colossus... but was shocked to see it announce a mate in 8!
I stepped through it's PV to get to here...
[d]8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
...which Colossus thought was a mate in 1 (Qf1+)! OOPS!!
So, it turns out that there WAS still a bug in one of my 'generate-moves-out-of-check' routines but it only occurred when a BLACK PROMOTING pawn (it would have worked for white in a mirrored position or shifted one rank north) was blocking the rayed check... boy oh boy... glad I didn't make any bets! Humbling to accept that searching hundreds of billions of positions doesn't necessarily drive your code through all paths!
Perhaps someone with editing permissions would like to add this to the wiki page if they consider it worthy of note?
-
- Posts: 10282
- Joined: Thu Mar 09, 2006 12:37 am
- Location: Tel-Aviv Israel
Re: You gotta love Perft... just not too much!
I suggest that you add perft pgn command to verify your move generator.
The idea is that you take a big pgn and calculate the sum of perft(n) for all the positions in the pgn and find if the sum is correct(I am sure that part of the positions should have a promotion of a pawn in reply to check because it happens in chess games.
Movei support this command.
suppose that you have in the same folder the movei engine and also the pgn file that you want to calculate sum of perft(n) for all the positions in the pgn for some n that you choose n>=1
Suppose the name of the pgn is event.pgn
You only need to run movei in console mode and type
perftpgn event.pgn 2 and the program will give you sum of perft(2) for all positions in the pgn.
If you type
perfpgn event.pgn 3 then you will get the sum of perft(3)
Note that I stopped to work on movei many years ago and
I am not sure if movei has no bugs in calculating perft or in reading pgn.
The idea is that you take a big pgn and calculate the sum of perft(n) for all the positions in the pgn and find if the sum is correct(I am sure that part of the positions should have a promotion of a pawn in reply to check because it happens in chess games.
Movei support this command.
suppose that you have in the same folder the movei engine and also the pgn file that you want to calculate sum of perft(n) for all the positions in the pgn for some n that you choose n>=1
Suppose the name of the pgn is event.pgn
You only need to run movei in console mode and type
perftpgn event.pgn 2 and the program will give you sum of perft(2) for all positions in the pgn.
If you type
perfpgn event.pgn 3 then you will get the sum of perft(3)
Note that I stopped to work on movei many years ago and
I am not sure if movei has no bugs in calculating perft or in reading pgn.
-
- Posts: 855
- Joined: Sun May 23, 2010 1:32 pm
Re: You gotta love Perft... just not too much!
if you like you can find a lot of perft position and result in Vajolet test directory:
https://github.com/elcabesa/vajolet/blo ... ischer.txt
https://github.com/elcabesa/vajolet/blo ... /perft.txt
each line of the file contains a position and the perft value from depth 1 to depth 6 separed by ","
the positions are randomly sample from engine games
https://github.com/elcabesa/vajolet/blo ... ischer.txt
https://github.com/elcabesa/vajolet/blo ... /perft.txt
each line of the file contains a position and the perft value from depth 1 to depth 6 separed by ","
the positions are randomly sample from engine games
-
- Posts: 69
- Joined: Thu Nov 21, 2013 12:37 am
- Location: Manchester, UK
- Full name: Martin Bryant
Re: You gotta love Perft... just not too much!
@Uri
Oh I see... so instead of searching billions of positions from a single root position you search thousands of root positions to a much shallower depth and sum them... great idea. Of course you need at least one other engine that can do this to compare the results against So thank you for the suggestion and for Movei!
Going off at a tangent, I have a text file containing many 'curious' positions that I've collected over the years... do you remember this one you posted years ago to highlight a bug in Glaurung?
[d]8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
Love these weird positions. I think it's amazing that the best engines today (well Stockfish at least) just immediately see this as a draw!
@elcabesa
Thank you so much for that resource! I'm feeling warmer and cosier already
Oh I see... so instead of searching billions of positions from a single root position you search thousands of root positions to a much shallower depth and sum them... great idea. Of course you need at least one other engine that can do this to compare the results against So thank you for the suggestion and for Movei!
Going off at a tangent, I have a text file containing many 'curious' positions that I've collected over the years... do you remember this one you posted years ago to highlight a bug in Glaurung?
[d]8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
Love these weird positions. I think it's amazing that the best engines today (well Stockfish at least) just immediately see this as a draw!
@elcabesa
Thank you so much for that resource! I'm feeling warmer and cosier already
-
- Posts: 2554
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: You gotta love Perft... just not too much!
I believe in a small set of artificial positions that test all the gotchas with perft runs to very shallow depth.
It will run in a couple of milliseconds and the results will be way more valuable than running zillions of positions and waiting forever.
Especially useful when you need to re-test after bugfixes.
It has been discussed here in the past but you'd have to search the forum.
Jon has these in Arasan IIRC (among others).
Also don't forget that in FRC castling can be prevented due to backrank self-check.
It will run in a couple of milliseconds and the results will be way more valuable than running zillions of positions and waiting forever.
Especially useful when you need to re-test after bugfixes.
It has been discussed here in the past but you'd have to search the forum.
Jon has these in Arasan IIRC (among others).
Also don't forget that in FRC castling can be prevented due to backrank self-check.
Martin Sedlak
-
- Posts: 1968
- Joined: Wed Jul 13, 2011 9:04 pm
- Location: Madrid, Spain.
Re: You gotta love Perft... just not too much!
Hello Martin:
FWIW, here are JetChess perft counter results:
------------------------
First position:
[d]8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
------------------------
Second position:
[d]8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
------------------------
Regards from Spain.
Ajedrecista.
FWIW, here are JetChess perft counter results:
------------------------
First position:
[d]8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 1
2 Qf3-d5 1
3 Qf3-c6 1
4 Qf3*b7 1
5 Qf3-g4 1
6 Qf3-h5 1
7 Qf3-e2 1
8 Qf3-d1 1
9 Qf3-f4 1
10 Qf3-f5 1
11 Qf3-f6 1
12 Qf3-f7 1
13 Qf3-f8 1
14 Qf3-g3 1
15 Qf3-h3 1
16 Qf3-e3 1
17 Qf3-d3 1
18 Qf3-c3 1
19 Qf3-b3 1
20 Qf3-a3 1
21 Qf3-f2 1
22 Qf3-f1 1
23 Kg2-h2 1
24 Kg2-h3 1
25 Kg2-f1 1
26 Kg2-g1 1
27 Kg2*h1 1
Total: 27
27 (move pathes after 1 half move).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 16
2 Qf3-d5 16
3 Qf3-c6 15
4 Qf3*b7 14
5 Qf3-g4 15
6 Qf3-h5 15
7 Qf3-e2 15
8 Qf3-d1 5
9 Qf3-f4 12
10 Qf3-f5 16
11 Qf3-f6 17
12 Qf3-f7 16
13 Qf3-f8 16
14 Qf3-g3 16
15 Qf3-h3 16
16 Qf3-e3 13
17 Qf3-d3 15
18 Qf3-c3 17
19 Qf3-b3 16
20 Qf3-a3 16
21 Qf3-f2 16
22 Qf3-f1 4
23 Kg2-h2 15
24 Kg2-h3 15
25 Kg2-f1 15
26 Kg2-g1 15
27 Kg2*h1 13
Total: 390
390 (move pathes after 2 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 410
2 Qf3-d5 422
3 Qf3-c6 361
4 Qf3*b7 291
5 Qf3-g4 337
6 Qf3-h5 386
7 Qf3-e2 354
8 Qf3-d1 22
9 Qf3-f4 314
10 Qf3-f5 465
11 Qf3-f6 428
12 Qf3-f7 410
13 Qf3-f8 407
14 Qf3-g3 367
15 Qf3-h3 368
16 Qf3-e3 327
17 Qf3-d3 368
18 Qf3-c3 365
19 Qf3-b3 400
20 Qf3-a3 381
21 Qf3-f2 318
22 Qf3-f1 82
23 Kg2-h2 411
24 Kg2-h3 381
25 Kg2-f1 320
26 Kg2-g1 367
27 Kg2*h1 292
Total: 9354
9,354 (move pathes after 3 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 5899
2 Qf3-d5 6608
3 Qf3-c6 5432
4 Qf3*b7 3953
5 Qf3-g4 4844
6 Qf3-h5 5551
7 Qf3-e2 4713
8 Qf3-d1 379
9 Qf3-f4 4250
10 Qf3-f5 6799
11 Qf3-f6 6427
12 Qf3-f7 6259
13 Qf3-f8 6299
14 Qf3-g3 5330
15 Qf3-h3 5519
16 Qf3-e3 4394
17 Qf3-d3 5033
18 Qf3-c3 5056
19 Qf3-b3 5880
20 Qf3-a3 5895
21 Qf3-f2 4107
22 Qf3-f1 1126
23 Kg2-h2 5836
24 Kg2-h3 5349
25 Kg2-f1 4573
26 Kg2-g1 5214
27 Kg2*h1 3442
Total: 134167
134,167 (move pathes after 4 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 138960
2 Qf3-d5 155852
3 Qf3-c6 121304
4 Qf3*b7 83809
5 Qf3-g4 107489
6 Qf3-h5 119826
7 Qf3-e2 103674
8 Qf3-d1 1258
9 Qf3-f4 102071
10 Qf3-f5 158339
11 Qf3-f6 145979
12 Qf3-f7 143477
13 Qf3-f8 136666
14 Qf3-g3 113119
15 Qf3-h3 118792
16 Qf3-e3 102035
17 Qf3-d3 110892
18 Qf3-c3 105554
19 Qf3-b3 126624
20 Qf3-a3 120367
21 Qf3-f2 86114
22 Qf3-f1 20972
23 Kg2-h2 126411
24 Kg2-h3 111919
25 Kg2-f1 85841
26 Kg2-g1 106717
27 Kg2*h1 68598
Total: 2922659
2,922,659 (move pathes after 5 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 2043067
2 Qf3-d5 2400718
3 Qf3-c6 1875494
4 Qf3*b7 1179900
5 Qf3-g4 1577369
6 Qf3-h5 1789106
7 Qf3-e2 1498385
8 Qf3-d1 23534
9 Qf3-f4 1460575
10 Qf3-f5 2379999
11 Qf3-f6 2202790
12 Qf3-f7 2189457
13 Qf3-f8 2117195
14 Qf3-g3 1616046
15 Qf3-h3 1769424
16 Qf3-e3 1446800
17 Qf3-d3 1613799
18 Qf3-c3 1540867
19 Qf3-b3 1920057
20 Qf3-a3 1851273
21 Qf3-f2 1205034
22 Qf3-f1 321529
23 Kg2-h2 1841479
24 Kg2-h3 1616605
25 Kg2-f1 1189022
26 Kg2-g1 1506314
27 Kg2*h1 783792
Total: 42959630
42,959,630 (move pathes after 6 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 44252259
2 Qf3-d5 51796142
3 Qf3-c6 39893873
4 Qf3*b7 24406651
5 Qf3-g4 33595491
6 Qf3-h5 37403885
7 Qf3-e2 31348692
8 Qf3-d1 97895
9 Qf3-f4 32503481
10 Qf3-f5 51405304
11 Qf3-f6 47637692
12 Qf3-f7 47023255
13 Qf3-f8 44057526
14 Qf3-g3 33558958
15 Qf3-h3 36392227
16 Qf3-e3 31633575
17 Qf3-d3 33779341
18 Qf3-c3 31914699
19 Qf3-b3 39645781
20 Qf3-a3 36734943
21 Qf3-f2 25046125
22 Qf3-f1 6136738
23 Kg2-h2 37846214
24 Kg2-h3 32303239
25 Kg2-f1 22440757
26 Kg2-g1 30357266
27 Kg2*h1 15585287
Total: 898797296
898,797,296 (move pathes after 7 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 679398792
2 Qf3-d5 818211933
3 Qf3-c6 636311309
4 Qf3*b7 362615718
5 Qf3-g4 513893076
6 Qf3-h5 581538175
7 Qf3-e2 479915024
8 Qf3-d1 1942029
9 Qf3-f4 479826230
10 Qf3-f5 801569459
11 Qf3-f6 743662006
12 Qf3-f7 738633069
13 Qf3-f8 698864140
14 Qf3-g3 501420741
15 Qf3-h3 560378434
16 Qf3-e3 466204810
17 Qf3-d3 519668407
18 Qf3-c3 491717592
19 Qf3-b3 623626109
20 Qf3-a3 581173372
21 Qf3-f2 373707786
22 Qf3-f1 104168822
23 Kg2-h2 584042362
24 Kg2-h3 495811901
25 Kg2-f1 314299765
26 Kg2-g1 439912431
27 Kg2*h1 183502917
Total: 13776016409
13,776,016,409 (move pathes after 8 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 14121497680
2 Qf3-d5 16912831764
3 Qf3-c6 13095468820
4 Qf3*b7 7354886931
5 Qf3-g4 10591111014
6 Qf3-h5 11829340293
7 Qf3-e2 9761516479
8 Qf3-d1 7743493
9 Qf3-f4 10210708624
10 Qf3-f5 16591304499
11 Qf3-f6 15471611915
12 Qf3-f7 15239601790
13 Qf3-f8 14238403577
14 Qf3-g3 10229529752
15 Qf3-h3 11353583884
16 Qf3-e3 9794154338
17 Qf3-d3 10568629839
18 Qf3-c3 9979277108
19 Qf3-b3 12579228547
20 Qf3-a3 11510736023
21 Qf3-f2 7665402220
22 Qf3-f1 1997500610
23 Kg2-h2 11660507736
24 Kg2-h3 9693913965
25 Kg2-f1 5989115732
26 Kg2-g1 8820377379
27 Kg2*h1 3666868008
Total: 280934852020
280,934,852,020 (move pathes after 9 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 229051918319
2 Qf3-d5 279913009105
3 Qf3-c6 219025117242
4 Qf3*b7 117591776369
5 Qf3-g4 171218402338
6 Qf3-h5 193577642122
7 Qf3-e2 158744542570
8 Qf3-d1 164182745
9 Qf3-f4 157427397766
10 Qf3-f5 271783797498
11 Qf3-f6 253632232167
12 Qf3-f7 250905997217
13 Qf3-f8 235729250880
14 Qf3-g3 162724064213
15 Qf3-h3 184037916652
16 Qf3-e3 151196637763
17 Qf3-d3 172788014801
18 Qf3-c3 163426496951
19 Qf3-b3 208299912413
20 Qf3-a3 191480280026
21 Qf3-f2 122607502461
22 Qf3-f1 37023130162
23 Kg2-h2 192714491938
24 Kg2-h3 160300032793
25 Kg2-f1 86594354892
26 Kg2-g1 132955498297
27 Kg2*h1 46248557504
Total: 4551162157204
4,551,162,157,204 (move pathes after 10 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
1 Qf3-e4 4639240576627
2 Qf3-d5 5643850258030
3 Qf3-c6 4408578155286
4 Qf3*b7 2352954475738
5 Qf3-g4 3451130305535
6 Qf3-h5 3870284702050
7 Qf3-e2 3167251824222
8 Qf3-d1 703637654
9 Qf3-f4 3255840729546
10 Qf3-f5 5486343980658
11 Qf3-f6 5148457931823
12 Qf3-f7 5054982106848
13 Qf3-f8 4724108757950
14 Qf3-g3 3268935659958
15 Qf3-h3 3678391789721
16 Qf3-e3 3103067435753
17 Qf3-d3 3455087808740
18 Qf3-c3 3273555340342
19 Qf3-b3 4145011419201
20 Qf3-a3 3778864861725
21 Qf3-f2 2470715600826
22 Qf3-f1 709187300245
23 Kg2-h2 3782089600933
24 Kg2-h3 3098518454062
25 Kg2-f1 1666255902064
26 Kg2-g1 2654869996046
27 Kg2*h1 927271888594
Total: 91215550500177
91,215,550,500,177 (move pathes after 11 half moves).
Code: Select all
8/ppp3p1/8/8/3p4/5Q2/1ppp2K1/brk4n w - - 11 7
perft( 1) = 27
perft( 2) = 390
perft( 3) = 9,354
perft( 4) = 134,167
perft( 5) = 2,922,659
perft( 6) = 42,959,630
perft( 7) = 898,797,296
perft( 8) = 13,776,016,409
perft( 9) = 280,934,852,020
perft(10) = 4,551,162,157,204
perft(11) = 91,215,550,500,177
Second position:
[d]8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
1 qc2*h7 1
2 qh2*h7 1
3 kg7*h7 1
4 kg7-f6 1
5 kg7-g6 1
6 kg7-f8 1
7 kg7-g8 1
Total: 7
7 (move pathes after 1 half move).
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
1 qc2*h7 0
2 qh2*h7 0
3 kg7*h7 0
4 kg7-f6 13
5 kg7-g6 13
6 kg7-f8 13
7 kg7-g8 13
Total: 52
52 (move pathes after 2 half moves).
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
1 qc2*h7 0
2 qh2*h7 0
3 kg7*h7 0
4 kg7-f6 1173
5 kg7-g6 1134
6 kg7-f8 1150
7 kg7-g8 1136
Total: 4593
4,593 (move pathes after 3 half moves).
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
1 qc2*h7 0
2 qh2*h7 0
3 kg7*h7 0
4 kg7-f6 12875
5 kg7-g6 12407
6 kg7-f8 12568
7 kg7-g8 12418
Total: 50268
50,268 (move pathes after 4 half moves).
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
1 qc2*h7 0
2 qh2*h7 0
3 kg7*h7 0
4 kg7-f6 1203890
5 kg7-g6 1130012
6 kg7-f8 1161600
7 kg7-g8 1138882
Total: 4634384
4,634,384 (move pathes after 5 half moves).
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
1 qc2*h7 0
2 qh2*h7 0
3 kg7*h7 0
4 kg7-f6 12918613
5 kg7-g6 12129128
6 kg7-f8 12434860
7 kg7-g8 12202759
Total: 49685360
49,685,360 (move pathes after 6 half moves).
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
1 qc2*h7 0
2 qh2*h7 0
3 kg7*h7 0
4 kg7-f6 1257041566
5 kg7-g6 1160039868
6 kg7-f8 1204915549
7 kg7-g8 1181183228
Total: 4803180211
4,803,180,211 (move pathes after 7 half moves).
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
1 qc2*h7 0
2 qh2*h7 0
3 kg7*h7 0
4 kg7-f6 13231048562
5 kg7-g6 12207734928
6 kg7-f8 12669010038
7 kg7-g8 12429964013
Total: 50537757541
50,537,757,541 (move pathes after 8 half moves).
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
1 qc2*h7 0
2 qh2*h7 0
3 kg7*h7 0
4 kg7-f6 1330980120571
5 kg7-g6 1212934307577
6 kg7-f8 1276610769146
7 kg7-g8 1255748211784
Total: 5076273409078
5,076,273,409,078 (move pathes after 9 half moves).
Code: Select all
8/6kR/8/8/8/bq6/1rqqqqqq/K1nqnbrq b - - 0 1
perft(1) = 7
perft(2) = 52
perft(3) = 4,593
perft(4) = 50,268
perft(5) = 4,634,384
perft(6) = 49,685,360
perft(7) = 4,803,180,211
perft(8) = 50,537,757,541
perft(9) = 5,076,273,409,078
Regards from Spain.
Ajedrecista.
-
- Posts: 10282
- Joined: Thu Mar 09, 2006 12:37 am
- Location: Tel-Aviv Israel
Re: You gotta love Perft... just not too much!
mar wrote: ↑Sat Jul 27, 2019 1:03 pm I believe in a small set of artificial positions that test all the gotchas with perft runs to very shallow depth.
It will run in a couple of milliseconds and the results will be way more valuable than running zillions of positions and waiting forever.
Especially useful when you need to re-test after bugfixes.
It has been discussed here in the past but you'd have to search the forum.
Jon has these in Arasan IIRC (among others).
Also don't forget that in FRC castling can be prevented due to backrank self-check.
calculate the sum of some million of perft(2) from a big pgn is not waiting forever and I believe it has good chances to cover all the cases.
I doubt if a small set cover all the cases that you can think about.
I remember that I had a mistake when I believed double check cannot be done from 2 rook directions(it can be done if a pawn capture and promote gxh8+ when both h8 and rook g6 threat check).
-
- Posts: 2554
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: You gotta love Perft... just not too much!
I disagree.
you can always add a new corner case if you miss something, I never claimed it'll cover 100% cases
as for what you propose: first you need to parse the pgn, extract million positions and then run million perft(2),
this will be orders of magnitude slower (even if you preprocess and parallelize) than doing say 20-30 artificial positions for both sides.
you'll also need to get the correct perft values first so you need to preprocess this million of positions with an engine you trust,
so even more work to do
99.9% of those million(s) of positions won't stress test your movegen so it's a waste of effort and processing time plus I bet you will cover less corner cases with that
by increasing the sample size you also increase processing time, I hope you realize now how inefficient that would be
Martin Sedlak
-
- Posts: 10282
- Joined: Thu Mar 09, 2006 12:37 am
- Location: Tel-Aviv Israel
Re: You gotta love Perft... just not too much!
My point is that you probably cannot think in advance about all corner cases and the time of calculating sum of million perft(2) is relatively small to the time you work on your move generator(even if it takes one hour then you spend many hours on your move generator.mar wrote: ↑Sat Jul 27, 2019 5:06 pmI disagree.
you can always add a new corner case if you miss something, I never claimed it'll cover 100% cases
as for what you propose: first you need to parse the pgn, extract million positions and then run million perft(2),
this will be orders of magnitude slower (even if you preprocess and parallelize) than doing say 20-30 artificial positions for both sides.
you'll also need to get the correct perft values first so you need to preprocess this million of positions with an engine you trust,
so even more work to do
99.9% of those million(s) of positions won't stress test your movegen so it's a waste of effort and processing time plus I bet you will cover less corner cases with that
by increasing the sample size you also increase processing time, I hope you realize now how inefficient that would be
Initially you can use small number of positions but you can also use sum of perft(2) with many positions as another test.
-
- Posts: 1754
- Joined: Tue Apr 19, 2016 6:08 am
- Location: U.S.A
- Full name: Andrew Grant
Re: You gotta love Perft... just not too much!
I opened the Fischer one, and recognized itelcabesa wrote: ↑Sat Jul 27, 2019 11:10 am if you like you can find a lot of perft position and result in Vajolet test directory:
https://github.com/elcabesa/vajolet/blo ... ischer.txt
https://github.com/elcabesa/vajolet/blo ... /perft.txt
each line of the file contains a position and the perft value from depth 1 to depth 6 separed by ","
the positions are randomly sample from engine games
The next one though. Thats a lengthy PERFT suite.
#WeAreAllDraude #JusticeForDraude #RememberDraude #LeptirBigUltra
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )
"Those who can't do, clone instead" - Eduard ( A real life friend, not this forum's Eduard )