Gentelmen, check your engines.

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Gentelmen, check your engines.

Post by JVMerlino »

Ras wrote: Mon Sep 06, 2021 12:19 pm
klx wrote: Mon Sep 06, 2021 2:19 amYour engine has found a mate, but you have no clue whether it's the shortest one or not.
I do because mine finds a mate in 5, but no mate in 4:

Code: Select all

position fen 3R1R2/K3k3/1p1nPb2/pN2P2N/nP1ppp2/4P3/6P1/4Qq1r w 0 1
go mate 5
info depth 9 seldepth 9 score mate 5 time 3248 nodes 1799115 nps 553914 hashfull 0 tbhits 0 pv e1e2 d6c8 d8c8 e7e6 e2g4 e6e5 c8e8 e5d5 g4e6
bestmove e1e2
go mate 4
info depth 7 seldepth 7 score cp 0 time 221 nodes 86838 nps 392932 hashfull 0 tbhits 0
info string error (no mate found)
bestmove 0000
Cool, but not all engines work that way unless they're in mate-finder mode. Looking back at the output for The King, you can see that first it reported Mate in 8, then Mate in 7 (with the same move but one depth later), then Mate in 5 with a different move.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Gentelmen, check your engines.

Post by Ras »

JVMerlino wrote: Mon Sep 06, 2021 10:52 pmCool, but not all engines work that way unless they're in mate-finder mode.
For my engine, go mate X invokes the mate finder mode because that's what this go parameter is for. Otherwise, with go infinite, the output may vary until it finds the correct mate distance (if it does).
Rasmus Althoff
https://www.ct800.net
JVMerlino
Posts: 1357
Joined: Wed Mar 08, 2006 10:15 pm
Location: San Francisco, California

Re: Gentelmen, check your engines.

Post by JVMerlino »

Ras wrote: Tue Sep 07, 2021 12:05 am
JVMerlino wrote: Mon Sep 06, 2021 10:52 pmCool, but not all engines work that way unless they're in mate-finder mode.
For my engine, go mate X invokes the mate finder mode because that's what this go parameter is for. Otherwise, with go infinite, the output may vary until it finds the correct mate distance (if it does).
Ah, I didn't even know that was in the UCI spec. Not sure how many engines implement it, though.
BrokenKeyboard
Posts: 24
Joined: Tue Mar 16, 2021 11:11 pm
Full name: Het Satasiya

Re: Gentelmen, check your engines.

Post by BrokenKeyboard »

Its not in the UCI spec, but some choose to implement functions outside of it for testing purposes.
User avatar
emadsen
Posts: 434
Joined: Thu Apr 26, 2012 1:51 am
Location: Oak Park, IL, USA
Full name: Erik Madsen

Re: Gentelmen, check your engines.

Post by emadsen »

MadChess finds mate in 5 in about 11 seconds.

Code: Select all

❯ .\MadChess.Engine.exe
position fen 3R1R2/K3k3/1p1nPb2/pN2P2N/nP1ppp2/4P3/6P1/4Qq1r w - - 0 1
go mate 5
info depth 1 seldepth 15 time 58 nodes 3114 score cp 2084 nps 53943 pv e5f6
info depth 2 seldepth 15 time 65 nodes 5325 score cp 2084 nps 82355 pv e5f6 e7e6
info depth 3 seldepth 18 time 69 nodes 12001 score cp 2300 nps 173009 pv e5d6 e7e6 d8e8
info depth 4 seldepth 18 time 72 nodes 16736 score cp 2300 nps 231489 pv e5d6 e7e6 d8e8 e6d5
info depth 5 seldepth 15 time 78 nodes 26116 score cp 2300 nps 336648 pv e5d6 e7e6 d8e8 e6d5 e1f1
info depth 6 seldepth 15 time 82 nodes 39483 score cp 2084 nps 483647 pv e5f6 e7e6 d8d6 e6f5 b5d4 f5e5
info depth 7 seldepth 17 time 95 nodes 82524 score cp 2393 nps 867751 pv e5f6 e7e6 d8d6 e6f5 d6d5 f5g6 e1f1
info depth 8 seldepth 18 time 118 nodes 138224 score cp 2135 nps 1170504 pv e5f6 e7e6 d8d6 e6f5 b5d4 f5g4 e1f1 h1f1
info depth 9 seldepth 21 time 185 nodes 361021 score cp 2220 nps 1947434 pv e5f6 e7e6 d8d6 e6f5 d6d5 f5g6 f8g8 g6f7 g8g7
info depth 10 seldepth 21 time 270 nodes 637898 score cp 2142 nps 2363125 pv e5f6 e7e6 d8d6 e6f5 d6d5 f5g6 e1f1 h1f1 h5f4 g6h6
info depth 11 seldepth 26 time 1294 nodes 4592792 score mate 7 nps 3550605 pv b5d6 f1a6 a7a6 e7e6 h5f4 e6e5 d6c4 e5f5 d8d5 f5g4 f8g8
info depth 12 seldepth 25 time 2235 nodes 8077697 score mate 7 nps 3614977 pv b5d6 f1a6 a7a6 e7e6 h5f4 e6e5 d6c4 e5f5 d8d5 f5g4 f8g8 f6g5
info depth 13 seldepth 26 time 4202 nodes 15091770 score mate 7 nps 3591354 pv b5d6 f1a6 a7a6 e7e6 h5f4 e6e5 d6c4 e5f5 d8d5 f5g4 f8g8 f6g5 d5g5
info depth 14 seldepth 27 time 10897 nodes 39310471 score mate 5 nps 3607356 pv e1e2 d6b5 e2b5 f1b5 e5f6 e7e6 h5g7 e6e5 e3d4
bestmove e1e2
My C# chess engine: https://www.madchess.net
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Gentelmen, check your engines.

Post by Ras »

BrokenKeyboard wrote: Tue Sep 07, 2021 4:18 amIts not in the UCI spec
Of course it is, in the go command right before go movetime.
Rasmus Althoff
https://www.ct800.net
BrokenKeyboard
Posts: 24
Joined: Tue Mar 16, 2021 11:11 pm
Full name: Het Satasiya

Re: Gentelmen, check your engines.

Post by BrokenKeyboard »

Oh oops. I accidentally searched for go mate instead of just mate.
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Gentelmen, check your engines.

Post by lucasart »

Chessnut1071 wrote: Sat Sep 04, 2021 8:50 pm I have another 5-move mate puzzle which some powerful engines fail to find the minimum mate.

[fen]3R1R2/K3k3/1p1nPb2/pN2P2N/nP1ppp2/4P3/6P1/4Qq1r w 0 1[/fen]
Demolito: 8 threads, 1GB Hash

Code: Select all

info depth 15 score mate 10 time 125 nodes 1090872 hashfull 5 pv e5f6 e7e6 d8d6 e6f5 d6d5 f5g6 h5f4 f1f4 e1h1 f4f5 f8g8 g6f6 h1h8 f6e6 d5f5 d4e3 h8f6 e6d7 f6d6
info depth 18 score mate 9 time 249 nodes 2299570 hashfull 7 pv e5f6 e7e6 d8d6 e6f5 b5d4 f5g5 e3f4 g5h5 f8h8 h5g4 h8g8 g4h5 g2g4 h5h6 f6f7 h6h7 e1e4
info depth 19 score mate 8 time 307 nodes 2936746 hashfull 9 pv e5f6 e7e6 d8d6 e6f5 b5d4 f5g5 f8g8 g5h5 d6d5 h5h6 d4f5 h6h7 g8g7 h7h8 d5d8
info depth 21 score mate 7 time 1673 nodes 20327334 hashfull 83 pv b5d6 f1a6 a7a6 e7e6 h5f6 a4c5 b4c5 h1h7 d8e8 h7e7 e8e7 e6e7 f8e8
Disable razoring:

Code: Select all

info depth 13 score mate 12 time 98 nodes 803755 hashfull 5 pv e5f6 e7e6 d8d6 e6f5 d6d5 f5g6 h5f4 f1f4 e1h1 f4f5 d5f5 g6f5 b5d4 f5e5 h1h5 e5d6 h5e8 a4c5 e8c6 d6e5 b4c5
info depth 17 score mate 8 time 448 nodes 4018399 hashfull 20 pv e5f6 e7e6 d8d6 e6f5 d6d5 f5g6 f8g8 g6h6 h5f4 h6h7 g8g7 h7h6 d5d8 f1e1 d8h8
info depth 18 score mate 7 time 751 nodes 6893626 hashfull 44 pv e5f6 e7e6 d8d6 e6f5 h5g3 f5g6 f8g8 g6f7 g8g7 f7e8 g7e7 e8f8 d6d8
Also disable eval pruning:

Code: Select all

info depth 10 score mate 9 time 117 nodes 800242 hashfull 4 pv e5f6 e7e6 d8d6 e6f5 d6d5 f5g6 h5f4 f1f4 e3f4 h1h7 a7a8 h7a7 b5a7 a5b4 e1e4 g6h6 f8h8
info depth 14 score mate 8 time 240 nodes 1547299 hashfull 11 pv e5f6 e7e6 d8d6 e6f5 d6d5 f5g6 e3f4 f1g2 e1h1 g2h1 d5g5 g6h7 g5g7 h7h6 f8h8
info depth 17 score mate 7 time 1270 nodes 10786010 hashfull 77 pv b5d6 f1a6 a7a6 e7e6 e1h1 f6d8 h5f4 e6d7 h1h7 d8e7 h7f5 d7c6 f8c8
info depth 19 score mate 5 time 13957 nodes 131927387 hashfull 646 pv e1e2 f1e2 h5g7 d6b5 a7b7 f6e5 f8f7 e7d8 f7d7
Also disable SEE pruning in search (still enabled in qsearch):

Code: Select all

info depth 12 score mate 11 time 244 nodes 1468521 hashfull 6 pv e5f6 e7e6 d8d6 e6f5 d6d5 f5g6 h5f4 f1f4 e1h1 f4g5 d5g5 g6g5 b5d4 a4c5 f8g8 g5f6 h1h6 f6e7 b4c5 b6c5 h6e6
info depth 15 score mate 8 time 458 nodes 3164878 hashfull 14 pv e5f6 e7e6 d8d6 e6f5 b5d4 f5g5 f8g8 g5h5 d6d5 h5h6 d4f5 h6h7 g8g7 h7h8 d5d8
info depth 16 score mate 7 time 1060 nodes 8954810 hashfull 51 pv b5d6 f1a6 a7a6 e7e6 h5f6 a4c5 b4c5 h1h7 f8e8 h7e7 e8e7 e6e7 d8e8
info depth 20 score mate 5 time 29047 nodes 285778024 hashfull 871 pv e1e2 f1e2 h5g7 d6b5 a7b7 f6e5 f8f7 e7d8 f7d7
In practice, none of this matters. Finding any mate or even just a winning continuation is all that counts for elo. And that's also how humans play chess.

In order to solve these (totally artificial) puzzles, you need to disable, or impose drastic depth limits, on things like razoring, eval pruning, or SEE pruning. But this loses elo, of course. So you could have a "Tactical" option in the engine that does that (disabled by default).
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
pedrojdm2021
Posts: 157
Joined: Fri Apr 30, 2021 7:19 am
Full name: Pedro Duran

Re: Gentelmen, check your engines.

Post by pedrojdm2021 »

Code: Select all

> go depth 11
bestmove h5f6 score 1142 seached nodes 8814576
search done in 8620ms  illegal Moves: 0
i don't know if that is a good move :mrgreen:

No multi-threading, running everything on a single thread of my FX-8350
bob
Posts: 20943
Joined: Mon Feb 27, 2006 7:30 pm
Location: Birmingham, AL

Re: Gentelmen, check your engines.

Post by bob »

Thought I would try this. This on my MacBook pro, 2.3ghz quad-core...

14 0.17/21.00 Mat07 1. exf6+ Kxe6 2. Rxd6+ Kf5 3. Ng3+ Kg6
4. Rg8+ Kh7 5. Rg7+ Kh6 6. Rd8 Qxe1
7. Rh8#
14 0.24/36.00 Mat05 1. Qe2 Qxe2 2. Ng7 Nxb5+ 3. Kb7 Bxe5
4. Rf7+ Kxd8 5. Rd7#
14-> 0.24/36.00 Mat05 1. Qe2 Qxe2 2. Ng7 Nxb5+ 3. Kb7 Bxe5
4. Rf7+ Kxd8 5. Rd7# (s=2)
15 0.24/36.00 Mat05 1. Qe2 Qxe2 2. Ng7 Nxb5+ 3. Kb7 Bxe5
4. Rf7+ Kxd8 5. Rd7# (s=2)
15-> 0.26/32.40 Mat05 1. Qe2 Qxe2 2. Ng7 Nxb5+ 3. Kb7 Bxe5
4. Rf7+ Kxd8 5. Rd7# (s=2)
16 0.27/32.40 Mat05 1. Qe2 Qxe2 2. Ng7 Nxb5+ 3. Kb7 Bxe5
4. Rf7+ Kxd8 5. Rd7# (s=2)
16-> 0.29/29.10 Mat05 1. Qe2 Qxe2 2. Ng7 Nxb5+ 3. Kb7 Bxe5
4. Rf7+ Kxd8 5. Rd7# (s=2)
time=0.29(63%) nodes=7549375(7.5M) fh1=91% pred=1 nps=26.0M
chk=229.6K qchk=633.6K fp=2.0M mcp=2.2K 50move=1
LMReductions: 1/38.7K 2/22.7K 3/23.1K 4/23.0K 5/2.9K 6/14
null-move (R): 3/108.7K 4/14.6K 5/164
splits=1.7K(638) aborts=134 joins=5.3K data=9%(9%)

mate in 5 moves.

White(1): Qe2
time used: 0.29