Why do engines lack mate solving?

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Why do engines lack mate solving?

Post by Ras »

I remember the 80s when the 8 bit Mephistos were capable of dedicated mate solving, along with the interesting feature of looking for alternative solution moves. That seems to have dropped out of fashion somehow. Why?

It can't be that it's hard to implement. For the CT800, it took me a weekend to add this (including looking for alternate key moves), and most of the work was to integrate it seamlessly into the user interface, which is always somewhat difficult with an embedded system.

Is multi-variant analysis actually sufficient? Do modern engines reliably detect the shortest mating paths despite possible pruning?
User avatar
yurikvelo
Posts: 710
Joined: Sat Dec 06, 2014 1:53 pm

Re: Why do engines lack mate solving?

Post by yurikvelo »

Because it hurts ELO
It can't be that it's hard to implement.
it is implemented
http://talkchess.com/forum/viewtopic.php?t=61419
Do modern engines reliably detect the shortest mating paths despite possible pruning?
no, it hurts ELO
Jhoravi
Posts: 291
Joined: Wed May 08, 2013 6:49 am

Re: Why do engines lack mate solving?

Post by Jhoravi »

Because Mate solving is Brute Force. It hurts depth.
User avatar
yurikvelo
Posts: 710
Joined: Sat Dec 06, 2014 1:53 pm

Re: Why do engines lack mate solving?

Post by yurikvelo »

Ras wrote:That seems to have dropped out of fashion somehow. Why?
For simple tasks, such as 7-men or less positions - exact and immediate DTM score is available for free (TB7 Lomonosov)

For hard tasks, such as 8+ positions 1980s approach do not work, solution is far beyond brute force techniques (except for very short DTMs).

Best of what is available nowdays is Matefinder (Stockfish fork) with Syzygy-6 tables - dedicated DTM-solving tool.

Probably better or faster result can be achieved with Nalimov 6-men tablebases, but they are very impractical (1TB+ size) and lack support by SF.
kgburcham
Posts: 2016
Joined: Sun Feb 17, 2008 4:19 pm

Re: Why do engines lack mate solving?

Post by kgburcham »

just an example

[D] 4k2r/p1q1np1p/1p2p1p1/2p1P1B1/6Q1/2P5/PP4PP/3R2K1 w k -


8 processor(s) found, POPCNT available
NUMA configuration with 1 node(s),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Qa4+ Qc6 2.Rd8+ Kxd8 3.Qxc6 Rg8 4.Qb7 Re8 5.Qb8+ Kd7 6.Qd6+ Kc8 7.Bxe7 Rxe7 8.Qxe7 g5 9.Qxf7 g4 10.Qxe6+ Kc7 11.Qd5 h6 12.e6 b5 13.e7 g3 14.e8Q (1.312.914.138) 31389 TB:3
28/66 0:53 +M15 1.Qa4+ Qc6 2.Rd8+ Kxd8 3.Qxc6 Re8 4.Qd6+ Kc8 5.Bxe7 Rxe7 6.Qxe7 g5 7.Qxf7 g4 8.Qxe6+ Kc7 9.Qd5 h6 10.e6 b5 11.e7 g3 12.e8Q gxh2+ 13.Kxh2 Kb6 14.Qdd8+ (1.710.378.134) 31942 TB:3


Engine: Stockfish 170916 64 BMI2 (8192 MB)
by T. Romstad, M. Costalba, J. Kiiski, G.
Found 172 tablebases.

37/52 0:07 +70.64++ 1.Qa4+ (164.236.084) 21816 TB:115
37/52 0:07 +74.73++ 1.Qa4+ (166.600.840) 21829 TB:115
37/52 0:07 +79.87++ 1.Qa4+ (167.141.856) 21837 TB:115
37/52 0:07 +86.30++ 1.Qa4+ (167.445.673) 21836 TB:115
37/52 0:07 +94.37++ 1.Qa4+ (167.659.978) 21842 TB:115
37/52 0:07 +104.47++ 1.Qa4+ (167.853.667) 21844 TB:115
37/52 0:07 +117.11++ 1.Qa4+ (168.121.379) 21850 TB:115
37/52 0:09 +M20 1.Qa4+ Qc6 2.Rd8+ Kxd8 3.Qxc6 h6 4.Bf6 g5 5.Qb7 Re8 6.Qxa7 h5 7.Qxb6+ Kc8 8.Qxc5+ Kb7 9.Bxe7 Rxe7 10.Qxe7+ Kc6 11.Qd6+ Kb7 12.Qd7+ Kb8 13.Qxf7 h4 14.Qxe6 (201.894.165) 22169 TB:576
38/52 0:09 +M19 1.Qa4+ Qc6 2.Rd8+ Kxd8 3.Qxc6 h6 4.Bf6 g5 5.Qb7 Re8 6.Qxa7 b5 7.Qxc5 h5 8.Qd6+ Kc8 9.Bxe7 Rxe7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Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Why do engines lack mate solving?

Post by Ras »

As for the ELO impact, of course I didn't imply just putting it into the usual search, but into a special mode that is just alpha-beta-minimax along with using the hash tables for positions/branches that are not mate for either side. So, avoiding any kind of pruning since this might overlook key moves within the given mating depth.

Or is it just that usual chess puzzles are given with "mate in 2-8", and that pruning and stuff will not kick in at that depth anyway? Because PC programs easily have 20 plies search depth and prune only on the last few plies so that "mate in 8" is more or less within the brute force base horizon?

In that case, a multivariant analysis of course would solve the problem even when considering possible alternative key moves.
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: Why do engines lack mate solving?

Post by syzygy »

Ras wrote:Because PC programs easily have 20 plies search depth and prune only on the last few plies so that "mate in 8" is more or less within the brute force base horizon?
They prune/reduce considerably more than that.

Shortest-mate finding and strongest play do not go together very well. The top engines have gone for strongest play; otherwise they would not have been top engines. For shortest-mate finding other programs are probably better.

A UCI engine has little reason to offer both possibilities in one. It is also not clear how to achieve that from a GUI point of view, although I guess a check button option could be provided that lets the engine switch between two entirely different search algorithms.
Milos
Posts: 4190
Joined: Wed Nov 25, 2009 1:47 am

Re: Why do engines lack mate solving?

Post by Milos »

syzygy wrote:Shortest-mate finding and strongest play do not go together very well. The top engines have gone for strongest play; otherwise they would not have been top engines. For shortest-mate finding other programs are probably better.

A UCI engine has little reason to offer both possibilities in one. It is also not clear how to achieve that from a GUI point of view, although I guess a check button option could be provided that lets the engine switch between two entirely different search algorithms.
Why it is hard, you just merge regular SF and SF-mate-finder, you use conventional SF until you reach some high score like 10+ then you just switch to SF-mate-finder. There is no way that would hurt any Elo even if you test without GUI adjudication.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Why do engines lack mate solving?

Post by Ras »

syzygy wrote:They prune/reduce considerably more than that.
OK, didn't know that since I'm working with a middle-class engine. I failed to get the top-class working with 192kB RAM in total.
Shortest-mate finding and strongest play do not go together very well.
Agree. That is why I have put in a dedicated mate solver that only prunes based on alpha-beta and has no extensions. However, that would also be totally easy for PC based engines.
It is also not clear how to achieve that from a GUI point of view, although I guess a check button option could be provided
Yeah, that was my hook point, too, that there just might be no UCI/Winboard protocol switch that would even offer the engine the possibility to change its algorithm. Which in itself poses the question why not.
jplchess
Posts: 115
Joined: Mon Jan 25, 2010 7:13 am

Re: Why do engines lack mate solving?

Post by jplchess »

Chest does mate solving. In terms of efficiency it will hurt because it is time consuming and thus the rating goes down with Stockfish, for example.

I have asked that question before on this forum.
Jonathan Lee