How to solve positions with mate-threats?

Discussion of chess software programming and technical issues.

Moderator: Ras

lucasart
Posts: 3243
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: How to solve positions with mate-threats?

Post by lucasart »

JBNielsen wrote:Hi Lucas

Thanks for your informative post.

I assume you also are interested to know how fx Monarch can solve this so fast (and it should not even be particulary good at tactics!)....

Blacks last checks is probably also a big problem for DiscoCheck.
After some extensive testing, I decided to not reduce "bad checks". Bad checks are those with a negative SEE if capture or a negative history score if not, that are not discovered checks.
DiscoCheck now performs better on this position, and other tactical ones, but more importantly, it has not lost any elo. There is potentially even a small gain, although it's within the error bar of testing. Hopefully DiscoCheck will look less stupid in tactical situations now.

There is nothing magic in Monarch solving it in 4M nodes. As I showed in my post, a few trivial modifications to DiscoCheck, and I can also solve it in 4M nodes. But in general these modifications are far too costly, in terms of what they do to your tree size. So what you gain in tactics, you pay several folds in strategy and positional play (achieved by greater depths of search).

So, yes, Monarch will see Rxd3! in this position. But in a real game of chess, what are the chances that it will be smart enough to manouvre and create such a threat ? These threats rarely just "happen", the stronger your position the more likely you'll have tactical shots in your favor, and the easier your good moves are to find. The defending side however has a hard time playing razor sharp tactics to be able to hold the position, and is eventually forced to mistake.

So it all depends what you want to achieve: either elo or pure tactics, but you have to choose (or have an option for tactical mode so the user can choose).
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
JBNielsen
Posts: 267
Joined: Thu Jul 07, 2011 10:31 pm
Location: Denmark

Re: How to solve positions with mate-threats?

Post by JBNielsen »

lucasart wrote:
JBNielsen wrote:Hi Lucas

Thanks for your informative post.

I assume you also are interested to know how fx Monarch can solve this so fast (and it should not even be particulary good at tactics!)....

Blacks last checks is probably also a big problem for DiscoCheck.
After some extensive testing, I decided to not reduce "bad checks". Bad checks are those with a negative SEE if capture or a negative history score if not, that are not discovered checks.
DiscoCheck now performs better on this position, and other tactical ones, but more importantly, it has not lost any elo. There is potentially even a small gain, although it's within the error bar of testing. Hopefully DiscoCheck will look less stupid in tactical situations now.

There is nothing magic in Monarch solving it in 4M nodes. As I showed in my post, a few trivial modifications to DiscoCheck, and I can also solve it in 4M nodes. But in general these modifications are far too costly, in terms of what they do to your tree size. So what you gain in tactics, you pay several folds in strategy and positional play (achieved by greater depths of search).

So, yes, Monarch will see Rxd3! in this position. But in a real game of chess, what are the chances that it will be smart enough to manouvre and create such a threat ? These threats rarely just "happen", the stronger your position the more likely you'll have tactical shots in your favor, and the easier your good moves are to find. The defending side however has a hard time playing razor sharp tactics to be able to hold the position, and is eventually forced to mistake.

So it all depends what you want to achieve: either elo or pure tactics, but you have to choose (or have an option for tactical mode so the user can choose).
Have you just improved DiscoCheck now by trying all checks?
(I assume 'history score' is something more advanced than simple killers)

So you have moved a bit in the direction of Monarch.
But you still think, that Monarch is too tactical oriented, and that it may play stronger by focusing on more likely moves?!

I don't know how fast the strongest programs solve this position.
But if they solve it fast they show that it is possible to be both strong and solve difficult tactical positions.

- - -

I wondered if it is possible to immitate the human kind of play.

[d]2br1rk1/2qnQ2p/p4pp1/4p3/P1p1P1N1/2Pn1N1P/2B2PP1/1R1R1K2 w Rd1xNd3 Larsen1.99.100

1.Rxd3!, cxd3 2.Bb3+,Kh8 3.Nxf6!,Rxf6 4.Ng5! (Rxf2+ 5.Kg1,Rf1+ 6.Kh2)


In iteration 8 we consider all blacks moves after 4.Ng5!

[d]2br3k/2qnQ2p/p4rp1/4p1N1/P3P3/1BPp3P/5PP1/1R3K2 b

Most black moves leads to 5.Qxh7+ mate.
Moves with Nd7 looses Qc7.
Only 4.-,Rxf2+ 5.Kxf2 and 4.-,Rf7 5.Qxf7 gives an almost equal position (with a short search).

The fact that only 2 moves saves black could trigger a deeper search here.
After 4.-,Rxf2+ 5.Kxf2, Qc5+ black saves his life.
But after 4.-,Rxf2+ 5.Kg1 we have the same situation again.
Only a few moves saves black, and it triggers a deeper search.
And again after 5.-,Rf1+ 6.Kh2
And again after 6.-,Rh1+ 7.Kxh1
Now black must play fx 7.-,Nf8 and he looses his queen.

Is this a way to improve a programs tactical skill with only a little cost?
Pio
Posts: 338
Joined: Sat Feb 25, 2012 10:42 pm
Location: Stockholm

Re: How to solve positions with mate-threats?

Post by Pio »

Hi Jens!

I also think it is a good way extending the bishop move since the opponent only has two ways to escape the mate threat. I posted earlier a solution to this problem and other related problems in the link below. I would be really happy if someone would test the idea.

http://www.talkchess.com/forum/viewtopi ... hlight=pio

To make the idea cheaper, you could save the number of legal moves for the opponent in the hashtable so you will not have to recalculate the number of moves each time you reach the same position. You should also update the number of legal moves for the opponent (in the hashtable) when you know the exact score for the position. If you think it is to costly to count the number of legal moves you could skip doing that close to the leaf nodes.
lucasart
Posts: 3243
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: How to solve positions with mate-threats?

Post by lucasart »

Pio wrote: I also think it is a good way extending the bishop move since the opponent only has two ways to escape the mate threat.
Yes, in *this* position, it may do wonders to extend Bb3+, because Black ha sonly 2 legal moves and is in check. But in general, if you introduce a rule in the search like (if <= 2 legal move and in check, extend), it will significantly affect your average branching factor.
And to decide what is best, you must play thousands of games to know which version is best, not just see that i does better in this particular position. The occurrence of such tactical shots in the search tree is extremely rare! Note that your average position in the search tree doesn't typically look like your average root positions: plenty of pieces are out of order, some of them are hanging, often the best move is just to capture a stupid piece hanging somewhere etc.

As for DiscoCheck, I extend by one ply forced replies (1 legal mvove, whether in check or not).

Extending when you have 2 legal moves, I've never tested, so what I said about the effect on branching factor is just a guess. But the bottom line is: testing is the only thing that you should trust, not particular cases of a particular position, or even your intuition (often something is intuitively right but fails horribly in testing).
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.