[fen]b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w 0 1[/fen]
This is a quick but very nice way to see if your algorithm is missing something. The puzzle will test discovered check, pinned pieces and black pawn promotion. I've seen one engine fail to find this simple mate. 1. Qa6 . enjoy
Godfrey Heathcote's (1902) 2-move mate - engine tester
Moderator: Ras
-
- Posts: 313
- Joined: Tue Aug 03, 2021 2:41 pm
- Full name: Bill Beame
-
- Posts: 307
- Joined: Wed Sep 01, 2021 4:08 pm
- Location: Germany
- Full name: Roland Tomasi
Re: Godfrey Heathcote's (1902) 2-move mate - engine tester
Pygmalion (mate distance in the output is measured in ply):
Code: Select all
set-fen b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - - 0 1
New position: b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - -
debug-pvs 10
0: +11.1074 - Qxa8
19.0 N in 147 mcs => 129 kN/s
1: +11.1074 - Qxa8
46.0 N in 75.4 mcs => 610 kN/s
2: +8.09375 - Bb6 Bxh1 Qxe6
834 N in 552 mcs => 1.51 MN/s
3: +8.09375 - Bb6 Bxh1 Qxe6
659 N in 634 mcs => 1.04 MN/s
4: +13.0703 - Qc4 Ke1 Qxe6 Rg7
5.31 kN in 2.90 ms => 1.83 MN/s
5: +M3 - Qa6 Bxh1 Rd1
29.1 kN in 12.1 ms => 2.41 MN/s
6: +M3 - Qa6 Bxh1 Rd1
180 kN in 63.7 ms => 2.82 MN/s
7: +M3 - Qa6 Bxh1 Rd1
1.32 MN in 420 ms => 3.15 MN/s
8: +M3 - Qa6 Bxh1 Rd1
4.41 MN in 1.53 s => 2.89 MN/s
9: +M3 - Qa6 Bxh1 Rd1
29.8 MN in 9.53 s => 3.13 MN/s
10: +M3 - Qa6 Bxh1 Rd1
97.7 MN in 33.7 s => 2.90 MN/s
-
- Posts: 1062
- Joined: Tue Apr 28, 2020 10:03 pm
- Full name: Daniel Infuehr
Re: Godfrey Heathcote's (1902) 2-move mate - engine tester
My Movegen tells me - Invalid Fen. After using that fen: b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - - 0 1
I can expand to ply 8 but how would I detect a checkmate in 4 plies in the tree?
Depth: 8 - b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w 0 1
Perft 1: 45 0ms 2.36842 MNodes/s
Perft 2: 1061 0ms 21.6531 MNodes/s
Perft 3: 41844 0ms 394.755 MNodes/s
Perft 4: 1022681 1ms 973.055 MNodes/s
Perft 5: 39588532 18ms 2135.07 MNodes/s
Perft 6: 1025197177 704ms 1454.2 MNodes/s
Perft 7: 39590499692 18016ms 2197.49 MNodes/s
Perft 8: 1083679588098 489219ms 2215.12 MNodes/s
How do I detect a forced checkmate?
Worlds-fastest-Bitboard-Chess-Movegenerator
Daniel Inführ - Software Developer
Daniel Inführ - Software Developer
-
- Posts: 2703
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Godfrey Heathcote's (1902) 2-move mate - engine tester
CT800 V1.43:
Code: Select all
position fen b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - - 0 1
go infinite
info depth 2 seldepth 2 score cp 847 time 46 nodes 1287 nps 27978 hashfull 0 tbhits 32 pv a2a8 e2e1q
info depth 3 seldepth 4 score cp 1319 time 48 nodes 2445 nps 50937 hashfull 0 tbhits 32 pv a2a8 e2e1n a8f8 f1e2
info depth 4 seldepth 6 score cp 1289 time 50 nodes 4476 nps 89520 hashfull 0 tbhits 39 pv a2a8 e2e1n a8f8 f1e2 d3e3 e6e3
info depth 5 seldepth 8 score mate 5 time 54 nodes 8341 nps 154462 hashfull 0 tbhits 43 pv a2a8 e2e1n g1b6 f1e2 h1h2 e1g2 a8f3 e2e1
info depth 6 seldepth 9 score mate 5 time 61 nodes 13185 nps 216147 hashfull 0 tbhits 48 pv a2a8 e2e1n g1b6 f1e2 h1h2 e1g2 a8f3 e2e1 h4g2
info depth 7 seldepth 9 score mate 5 time 65 nodes 15151 nps 233092 hashfull 0 tbhits 54 pv a2a8 e2e1n g1b6 f1e2 h1h2 e1g2 a8f3 e2e1 h4g2
info depth 8 seldepth 9 score mate 5 time 76 nodes 29001 nps 381592 hashfull 0 tbhits 61 pv a2a8 e2e1n g1b6 f1e2 h1h2 e1g2 a8f3 e2e1 h4g2
info depth 9 seldepth 9 score mate 2 time 82 nodes 35090 nps 427926 hashfull 0 tbhits 77 pv a2a6 e2e1q d3f3
info depth 10 seldepth 10 score mate 2 time 83 nodes 35695 nps 430060 hashfull 0 tbhits 77 pv a2a6 e2e1q d3f3
go mate 2
info depth 3 seldepth 3 score mate 2 time 46 nodes 1016 nps 22086 hashfull 0 tbhits 0 pv a2a6 e6e4 g1d4
bestmove a2a6
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
- Posts: 2703
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Godfrey Heathcote's (1902) 2-move mate - engine tester
With an engine instead of a move generator.
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
- Posts: 307
- Joined: Wed Sep 01, 2021 4:08 pm
- Location: Germany
- Full name: Roland Tomasi
Re: Godfrey Heathcote's (1902) 2-move mate - engine tester
You would need a search function instead of a perft function: it should return a score instead of a counter. The score will have to encode if a position is a forced checkmate and if so, its distance in plies.dangi12012 wrote: ↑Sat Oct 02, 2021 1:41 pmMy Movegen tells me - Invalid Fen. After using that fen: b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - - 0 1
I can expand to ply 8 but how would I detect a checkmate in 4 plies in the tree?
Depth: 8 - b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w 0 1
Perft 1: 45 0ms 2.36842 MNodes/s
Perft 2: 1061 0ms 21.6531 MNodes/s
Perft 3: 41844 0ms 394.755 MNodes/s
Perft 4: 1022681 1ms 973.055 MNodes/s
Perft 5: 39588532 18ms 2135.07 MNodes/s
Perft 6: 1025197177 704ms 1454.2 MNodes/s
Perft 7: 39590499692 18016ms 2197.49 MNodes/s
Perft 8: 1083679588098 489219ms 2215.12 MNodes/s
How do I detect a forced checkmate?
Any node that does not have legal moves and is a check is a checkmate. Return the score for a forced mate in 0 ply in that case. If a node has legal moves, once you find a subnode in it that isn't a forced mate in n plies you can skip searching further moves and return a score indicating that it isn't a checkmate. If all subnodes are forced mates, then return the score of the most distant forced mate in the subnodes with the mate distance incremented by one.
-
- Posts: 915
- Joined: Sun Dec 27, 2020 2:40 am
- Location: Bremen, Germany
- Full name: Thomas Jahn
Re: Godfrey Heathcote's (1902) 2-move mate - engine tester
Code: Select all
MinimalChess 0.6.1
position fen b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - - 0 1
go
info string Search scheduled to take 715827862ms!
info depth 1 score cp 1001 nodes 104 nps 4521 time 23 pv a2a8
info depth 2 score cp 794 nodes 339 nps 12107 time 28 pv g1d4 a8h1
info depth 3 score cp 1274 nodes 1883 nps 58843 time 32 pv a2a8 e2e1n a8f8
info depth 4 score cp 1215 nodes 2636 nps 77529 time 34 pv a2a8 e2e1n a8f8 f1e2
info depth 5 score cp 1271 nodes 5106 nps 124536 time 41 pv a2a8 e2e1n a8f8 f1e2 d3d5
info depth 6 score cp 1230 nodes 7851 nps 160224 time 49 pv a2a8 e2e1n a8f8 f1e2 d3e3 e6e3
info depth 7 score mate 2 nodes 26859 nps 265930 time 101 pv a2a6 a8h1 d3d1
-
- Posts: 2134
- Joined: Wed Jul 13, 2011 9:04 pm
- Location: Madrid, Spain.
Re: Godfrey F. Heathcote's (1904) 2-move mate: engine tester.
Hello:
@Bill: The year of the problem is 1904 instead of 1902, according to multiple sources cited at Yet Another Chess Problem Database:
https://yacpdb.org/#32778
This problem is amazing, like many other two-movers composed in 19th and early 20th centuries. People were so creative! And they still are.
------------
@Daniel:
With a checkmate in X moves problem with the side to move being the winning side, the problem lasts 2X - 1 plies and not 2X plies. For example, in this case, sides to move are white, black and white (giving checkmate).
Regarding perft, you have another chance to test your move generator with perft(9) of this problem:
This perft(9) value was computed with gperft perft counter.
Regards from Spain.
Ajedrecista.
@Bill: The year of the problem is 1904 instead of 1902, according to multiple sources cited at Yet Another Chess Problem Database:
https://yacpdb.org/#32778
This problem is amazing, like many other two-movers composed in 19th and early 20th centuries. People were so creative! And they still are.

------------
@Daniel:
With a checkmate in X moves problem with the side to move being the winning side, the problem lasts 2X - 1 plies and not 2X plies. For example, in this case, sides to move are white, black and white (giving checkmate).
Regarding perft, you have another chance to test your move generator with perft(9) of this problem:
Code: Select all
b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - - 0 1
Qxe6 606,549,944,991
Rxd6 1,107,966,964,258
Qxa8 592,965,195,122
Qxe2+ 21,695,658,538
Ng6 2,359,047,289,324
Nf5 2,654,509,538,975
Nf3 1,784,571,051,456
Ng2 1,736,567,066,602
Qd5 969,963,756,463
Qc4 1,097,964,376,220
Qb3 929,406,983,982
Qb1+ 117,012,074,815
Ba7+ 43,808,336,233
Bb6+ 56,481,695,781
Bc5+ 53,212,630,286
Bd4+ 51,456,582,207
Be3+ 54,244,193,549
Bf2+ 97,584,763,987
Bh2+ 96,587,846,251
Rd5 963,493,575,113
Rd4 1,236,586,738,232
Re3 1,024,283,619,200
Rf3+ 43,576,929,238
Rg3 1,340,199,052,614
Rdh3 822,824,235,023
Rd2 1,211,610,571,630
Rd1+ 239,317,287,488
Qa7 1,313,790,835,575
Qa6 1,158,270,547,557
Qa5 1,415,643,029,295
Qa4 1,164,837,317,601
Qa3 926,760,230,691
Qb2 792,811,187,475
Qc2 792,444,078,042
Qd2 738,525,717,822
Qa1+ 146,045,179,540
Rhh3 2,364,120,821,585
Rh2 2,417,276,365,519
c4 1,208,342,032,837
Ka5 1,051,917,564,051
Kb5 1,283,767,403,954
Ka4 934,369,905,939
Kc4 834,880,520,162
Ka3 883,628,534,682
Kb3 1,205,810,153,778
TOTAL 41,946,729,383,683
Regards from Spain.
Ajedrecista.
-
- Posts: 982
- Joined: Fri Mar 10, 2006 4:29 pm
- Location: Germany
- Full name: Jörg Oster
Re: Godfrey Heathcote's (1902) 2-move mate - engine tester
My basic mate search inside Stockfish needs some more nodes:Ras wrote: ↑Sat Oct 02, 2021 1:57 pm CT800 V1.43:Code: Select all
position fen b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - - 0 1 go infinite info depth 2 seldepth 2 score cp 847 time 46 nodes 1287 nps 27978 hashfull 0 tbhits 32 pv a2a8 e2e1q info depth 3 seldepth 4 score cp 1319 time 48 nodes 2445 nps 50937 hashfull 0 tbhits 32 pv a2a8 e2e1n a8f8 f1e2 info depth 4 seldepth 6 score cp 1289 time 50 nodes 4476 nps 89520 hashfull 0 tbhits 39 pv a2a8 e2e1n a8f8 f1e2 d3e3 e6e3 info depth 5 seldepth 8 score mate 5 time 54 nodes 8341 nps 154462 hashfull 0 tbhits 43 pv a2a8 e2e1n g1b6 f1e2 h1h2 e1g2 a8f3 e2e1 info depth 6 seldepth 9 score mate 5 time 61 nodes 13185 nps 216147 hashfull 0 tbhits 48 pv a2a8 e2e1n g1b6 f1e2 h1h2 e1g2 a8f3 e2e1 h4g2 info depth 7 seldepth 9 score mate 5 time 65 nodes 15151 nps 233092 hashfull 0 tbhits 54 pv a2a8 e2e1n g1b6 f1e2 h1h2 e1g2 a8f3 e2e1 h4g2 info depth 8 seldepth 9 score mate 5 time 76 nodes 29001 nps 381592 hashfull 0 tbhits 61 pv a2a8 e2e1n g1b6 f1e2 h1h2 e1g2 a8f3 e2e1 h4g2 info depth 9 seldepth 9 score mate 2 time 82 nodes 35090 nps 427926 hashfull 0 tbhits 77 pv a2a6 e2e1q d3f3 info depth 10 seldepth 10 score mate 2 time 83 nodes 35695 nps 430060 hashfull 0 tbhits 77 pv a2a6 e2e1q d3f3 go mate 2 info depth 3 seldepth 3 score mate 2 time 46 nodes 1016 nps 22086 hashfull 0 tbhits 0 pv a2a6 e6e4 g1d4 bestmove a2a6
Code: Select all
uciok
position fen b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w 0 1
go mate 2
info string no mate in 1 found
info depth 3 seldepth 3 multipv 1 score mate 2 nodes 1729 nps 864500 tbhits 0 time 2 pv a2a6 d6d5 g1c5
bestmove a2a6 ponder d6d5
Jörg Oster
-
- Posts: 57
- Joined: Fri Jul 23, 2021 5:24 pm
- Location: Elin Pelin
- Full name: Guido Flohr
Re: Godfrey Heathcote's (1902) 2-move mate - engine tester
Recent stockfish seems to fail this test:
With "go mate" it also does not find the mate.
My engine can solve it:
But what is the correct output here? "mate 1" or "mate 2"? Does the move to make count or not?
Code: Select all
Stockfish 250721 by the Stockfish developers (see AUTHORS file)
position fen b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - - 0 1
go depth 5
info string NNUE evaluation using nn-76a8a7ffb820.nnue enabled
info depth 1 seldepth 1 multipv 1 score cp 938 nodes 187 nps 93500 tbhits 0 time 2 pv a2e6 a8h1
info depth 2 seldepth 2 multipv 1 score cp 1339 nodes 625 nps 208333 tbhits 0 time 3 pv a2a8 e2e1n a8f8 f1e2
info depth 3 seldepth 3 multipv 1 score cp 1339 nodes 708 nps 236000 tbhits 0 time 3 pv a2a8 e2e1n a8f8 f1e2
info depth 4 seldepth 4 multipv 1 score cp 1339 nodes 783 nps 261000 tbhits 0 time 3 pv a2a8 e2e1n a8f8 f1e2
info depth 5 seldepth 5 multipv 1 score cp 1100 nodes 1902 nps 380400 tbhits 0 time 5 pv a2a8 e2e1n h4f3 d6d5 g1c5 f1g2
bestmove a2a8 ponder e2e1n
My engine can solve it:
Code: Select all
Welcome to Plisco 0.4!
This engine implements the UCI protocol (see
http://wbec-ridderkerk.nl/html/UCIProtocol.html).
Try 'help' for a list of commands!
position fen b4b2/3r4/3pr3/8/1K5N/2PR4/Q3p3/5kBR w - - 0 1
go depth 5
info depth 1 seldepth 7 score cp 219 nodes 13 nps 8947 time 1 pv b4b5 a8h1
info depth 1 seldepth 7 score cp 241 nodes 28 nps 13359 time 2 pv b4c4 a8h1
info depth 1 seldepth 7 score cp 278 nodes 45 nps 15839 time 3 pv a2a8 e2e1q
info depth 1 seldepth 7 score cp 492 nodes 60 nps 17657 time 3 pv a2e6 e2e1q
info depth 1 seldepth 9 score cp 525 nodes 231 nps 20818 time 11 pv d3e3 e6e3
info depth 1 seldepth 9 score cp 575 nodes 369 nps 21014 time 18 pv h4f3 e2e1q
info depth 2 seldepth 11 score cp 575 nodes 533 nps 21735 time 25 pv h4f3 e2e1q
info depth 3 seldepth 18 score cp 740 nodes 4653 nps 26477 time 176 pv h4f3 a8f3 d3f3 f1g2
info depth 3 seldepth 18 score cp 780 nodes 6536 nps 26202 time 249 pv a2e6 a8h1 h4f3
info depth 3 seldepth 18 score cp 1229 nodes 8021 nps 26445 time 303 pv a2a8 e2e1n g1d4 f1e2 a8f8
info depth 3 seldepth 18 score mate 1 nodes 9589 nps 27465 time 349 pv a2a6 e2e1q d3f3
info depth 3 seldepth 18 score mate 1 nodes 11941 nps 28327 time 422 pv a2a6 e2e1q d3f3
bestmove a2a6