That's excellent. So it wasn't useless to post it hereelcabesa wrote:I have found a bug in my UCI setposition command trying your positions

Moderator: Ras
That's excellent. So it wasn't useless to post it hereelcabesa wrote:I have found a bug in my UCI setposition command trying your positions
Astounding.Ajedrecista wrote: Very useful positions! I have tried JetChess 1.0.0.0 and it agrees with all the positions except the two first (avoid illegal en passant capture). Indeed it is a tricky position: JetChess gives Perft(1) = 9 (including cxd6 e.p.) and Perft(6) = 960427, including 136363 of cxd6 e.p.; of course 960427 - 136363 = 824064.
[d]8/5bk1/8/2Pp4/8/1K6/8/8 w - d6 0 1
[d]8/8/1k6/8/2pP4/8/5BK1/8 b - d3 0 11 c5-c6 119793
2 c5*d6e 136363
3 Kb3-c3 118973
4 Kb3-a3 82957
5 Kb3-a4 80828
6 Kb3-b4 97074
7 Kb3-a2 76150
8 Kb3-b2 119231
9 Kb3-c2 129058
Total: 960427
In view of that, must I think that JetChess is buggy in some rare/extreme cases? I was able to compute Perft(11) after 1.- f3, f6 (~1.1653e+15) and my result agree with Steven Edward's result. Thanks in advance.1 c4-c3 119793
2 c4*d3e 136363
3 kb6-c6 118973
4 kb6-a6 82957
5 kb6-a5 80828
6 kb6-b5 97074
7 kb6-a7 76150
8 kb6-b7 119231
9 kb6-c7 129058
Total: 960427
Not quite - the one where en-passant capture is impossible due to a discovered check by a bishop can't actually occur in a game.mar wrote:Thanks Steve.Steve Maughan wrote:Also try this one:
[d]3k4/8/8/K1Pp3r/8/8/8/8 w - d6 0 1
Here the white pawn cannot take ep on d6 due to the discovered check. The point being, after both pieces are removed from the board there is discovered check.
Steve
This is actually the same case as the first two testpositions.
Martin
Yes Evert, excellent point.Evert wrote:Not quite - the one where en-passant capture is impossible due to a discovered check by a bishop can't actually occur in a game.
Code: Select all
3k4/3p4/8/K1P4r/8/8/8/8 b - - 0 1 perft 6 = 1134888
8/8/8/8/k1p4R/8/3P4/3K4 w - - 0 1 perft 6 = 1134888
@Steve: here are the results obtained with JetChess 1.0.0.0:Steve Maughan wrote:Also try this one:
[d]3k4/8/8/K1Pp3r/8/8/8/8 w - d6 0 1
Here the white pawn cannot take ep on d6 due to the discovered check. The point being, after both pieces are removed from the board there is discovered check.
Steve
Code: Select all
Perft(1):
Total: 6
-----------------------
Perft(2):
1 c5-c6 15
2 Ka5-b5 16
3 Ka5-a6 16
4 Ka5-b6 15
5 Ka5-a4 16
6 Ka5-b4 16
Total: 94
-----------------------
Perft(3):
1 c5-c6 84
2 Ka5-b5 104
3 Ka5-a6 90
4 Ka5-b6 101
5 Ka5-a4 92
6 Ka5-b4 107
Total: 578
-----------------------
Perft(4):
1 c5-c6 1284
2 Ka5-b5 1788
3 Ka5-a6 1544
4 Ka5-b6 1716
5 Ka5-a4 1617
6 Ka5-b4 1884
Total: 9833
-----------------------
Perft(5):
1 c5-c6 7887
2 Ka5-b5 10322
3 Ka5-a6 8977
4 Ka5-b6 9853
5 Ka5-a4 9710
6 Ka5-b4 11815
Total: 58564
-----------------------
Perft(6):
1 c5-c6 127497
2 Ka5-b5 182011
3 Ka5-a6 156082
4 Ka5-b6 171667
5 Ka5-a4 172818
6 Ka5-b4 210405
Total: 1020480
-----------------------
Perft(7):
1 c5-c6 813149
2 Ka5-b5 1076774
3 Ka5-a6 868915
4 Ka5-b6 971993
5 Ka5-a4 1053199
6 Ka5-b4 1300034
Total: 6084064
-----------------------
Perft(8):
1 c5-c6 13462794
2 Ka5-b5 19060051
3 Ka5-a6 15285404
4 Ka5-b6 17090279
5 Ka5-a4 18847515
6 Ka5-b4 23265216
Total: 107011259
-----------------------
Perft(9):
1 c5-c6 96519583
2 Ka5-b5 113067366
3 Ka5-a6 87738992
4 Ka5-b6 98696639
5 Ka5-a4 114799308
6 Ka5-b4 143581817
Total: 654403705
-----------------------
Perft(10):
1 c5-c6 1618387456
2 Ka5-b5 2009557285
3 Ka5-a6 1553104440
4 Ka5-b6 1747957136
5 Ka5-a4 2053840467
6 Ka5-b4 2568985667
Total: 11551832451
------------------------
Perft(11):
1 c5-c6 14269338389
2 Ka5-b5 12437781979
3 Ka5-a6 9387217977
4 Ka5-b6 10641341547
5 Ka5-a4 12835876918
6 Ka5-b4 16184139001
Total: 75755695811
------------------------
Perft(12):
1 c5-c6 239303947094
2 Ka5-b5 221125944407
3 Ka5-a6 166887447674
4 Ka5-b6 189184338673
5 Ka5-a4 229364060043
6 Ka5-b4 289214154340
Total: 1335079892231
--------------------------
Perft(13):
1 c5-c6 2755115218394
2 Ka5-b5 1487534432704
3 Ka5-a6 1119872389618
4 Ka5-b6 1277278878192
5 Ka5-a4 1533937202336
6 Ka5-b4 1944788321613
Total: 10118526442857
---------------------------
Perft(14):
1 c5-c6 45738172275508
2 Ka5-b5 26325276908553
3 Ka5-a6 19824853252447
4 Ka5-b6 22613834399082
5 Ka5-a4 27245485708371
6 Ka5-b4 34543305291286
Total: 176290927835247
----------------------------
Perft(15):
1 c5-c6 662866706386728
2 Ka5-b5 208447628762504
3 Ka5-a6 160018485567407
4 Ka5-b6 183410599918419
5 Ka5-a4 209279190800428
6 Ka5-b4 265146632375909
Total: 1689169243811395
------------------------------
Perft(16):
1 c5-c6 10845718850029518
2 Ka5-b5 3633206864174363
3 Ka5-a6 2786662949577909
4 Ka5-b6 3193787429941721
5 Ka5-a4 3663758710005513
6 Ka5-b4 4643588151781907
Total: 28766722955510931
@Martin: Thomas Zipproth is a member of TalkChess but he is not very active regarding number of posts. I did a report a while ago, noting problems with the order of castle rights (KQ and QK give different results in JetChess) and Thomas answered me saying that it is due to a FEN parsing bug. However, the last and only public release is 1.0.0.0 version from year 2006. I have not found other major bugs until I saw this interesting thread.mar wrote:Hi Jesus,
I'm glad you find it useful.
Yes this is a Jetchess bug for sure. I would be careful using that (perhaps you should contact the author and report a bug?).
Of course, when you calculate from startposition, you probably won't reach such case in first n plies (where n can be large).
Martin
Code: Select all
// avoid illegal ep (thanks to Steve Maughan):
3k4/3p4/8/K1P4r/8/8/8/8 b - - 0 1 perft 6 = 1134888
8/8/8/8/k1p4R/8/3P4/3K4 w - - 0 1 perft 6 = 1134888
// avoid illegal ep #2
8/8/4k3/8/2p5/8/B2P2K1/8 w - - 0 1 perft 6 = 1015133
8/b2p2k1/8/2P5/8/4K3/8/8 b - - 0 1 perft 6 = 1015133
en passant capture checks opponent:
8/8/1k6/2b5/2pP4/8/5K2/8 b - d3 0 1 perft 6 = 1440467
8/5k2/8/2Pp4/2B5/1K6/8/8 w - d6 0 1 perft 6 = 1440467
short castling gives check:
5k2/8/8/8/8/8/8/4K2R w K - 0 1 perft 6 = 661072
4k2r/8/8/8/8/8/8/5K2 b k - 0 1 perft 6 = 661072
long castling gives check:
3k4/8/8/8/8/8/8/R3K3 w Q - 0 1 perft 6 = 803711
r3k3/8/8/8/8/8/8/3K4 b q - 0 1 perft 6 = 803711
castling (including losing cr due to rook capture):
r3k2r/1b4bq/8/8/8/8/7B/R3K2R w KQkq - 0 1 perft 4 = 1274206
r3k2r/7b/8/8/8/8/1B4BQ/R3K2R b KQkq - 0 1 perft 4 = 1274206
castling prevented:
r3k2r/8/3Q4/8/8/5q2/8/R3K2R b KQkq - 0 1 perft 4 = 1720476
r3k2r/8/5Q2/8/8/3q4/8/R3K2R w KQkq - 0 1 perft 4 = 1720476
promote out of check:
2K2r2/4P3/8/8/8/8/8/3k4 w - - 0 1 perft 6 = 3821001
3K4/8/8/8/8/8/4p3/2k2R2 b - - 0 1 perft 6 = 3821001
discovered check:
8/8/1P2K3/8/2n5/1q6/8/5k2 b - - 0 1 perft 5 = 1004658
5K2/8/1Q6/2N5/8/1p2k3/8/8 w - - 0 1 perft 5 = 1004658
promote to give check:
4k3/1P6/8/8/8/8/K7/8 w - - 0 1 perft 6 = 217342
8/k7/8/8/8/8/1p6/4K3 b - - 0 1 perft 6 = 217342
underpromote to check:
8/P1k5/K7/8/8/8/8/8 w - - 0 1 perft 6 = 92683
8/8/8/8/8/k7/p1K5/8 b - - 0 1 perft 6 = 92683
self stalemate:
K1k5/8/P7/8/8/8/8/8 w - - 0 1 perft 6 = 2217
8/8/8/8/8/p7/8/k1K5 b - - 0 1 perft 6 = 2217
stalemate/checkmate:
8/k1P5/8/1K6/8/8/8/8 w - - 0 1 perft 7 = 567584
8/8/8/8/1k6/8/K1p5/8 b - - 0 1 perft 7 = 567584
double check:
8/8/2k5/5q2/5n2/8/5K2/8 b - - 0 1 perft 4 = 23527
8/5k2/8/5N2/5Q2/2K5/8/8 w - - 0 1 perft 4 = 23527
I do not understand what you mean. If both king and rook are on their original squares but the FEN does not include the corresponding castling right then one of the two pieces actually DID move prior to that position.Volker Annuss wrote:short castling impossible although the rook never moved away from its corner
1k6/1b6/8/8/7R/8/8/4K2R b K - 0 1 perft 5 = 1063513
4k2r/8/8/7r/8/8/1B6/1K6 w k - 0 1 perft 5 = 1063513
long castling impossible although the rook never moved away from its corner
1k6/8/8/8/R7/1n6/8/R3K3 b Q - 0 1 perft 5 = 346695
r3k3/8/1N6/r7/8/8/8/1K6 w q - 0 1 perft 5 = 346695
[d]
I should add: in the first two of your positions there is no reason for short castling not being allowed, other than the FEN stating so. A rook being attacked does not already prevent you from castling. An available castling right is temporarily unavailable if eitherSven Schüle wrote:I do not understand what you mean. If both king and rook are on their original squares but the FEN does not include the corresponding castling right then one of the two pieces actually DID move prior to that position.Volker Annuss wrote:short castling impossible although the rook never moved away from its corner
1k6/1b6/8/8/7R/8/8/4K2R b K - 0 1 perft 5 = 1063513
4k2r/8/8/7r/8/8/1B6/1K6 w k - 0 1 perft 5 = 1063513
long castling impossible although the rook never moved away from its corner
1k6/8/8/8/R7/1n6/8/R3K3 b Q - 0 1 perft 5 = 346695
r3k3/8/1N6/r7/8/8/8/1K6 w q - 0 1 perft 5 = 346695
[d]
Sven
I was confused about the point of those positions too when I first saw them, more so when I ran them through my perft function and got the quoted count.Sven Schüle wrote: I should add: in the first two of your positions there is no reason for short castling not being allowed, other than the FEN stating so. A rook being attacked does not already prevent you from castling.