Best was to Recognize Know Endgames?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Best was to Recognize Know Endgames?

Post by Don »

lucasart wrote:
Don wrote:
hgm wrote:Something is a bit suspect here: just before it finds the mating line at 34 ply, with score +M23, it gets a '33+' line with a score of +150.93. I don't see how it could ever get such a score from normal (material + PST + mobility) evaluation, and it is not a mate score either. So it seems to have some pattern, and considering the root material, only KBNK patterns can match.
There is some bug in Komodo that also makes it do that sort of thing. It will see a mate but report it as something like a mate taking 100 moves or more. I think it is a hash table interaction with the maximum mate depth Komodo can report - so with the hash table Komodo perhaps strings together a mate in some ridiculous number of ply and then moves on to the next iteration.
I'm glad I'm not the only one to have this problem. I never bothered to investigate it as it never had anymore than a cosmetic effect (still plays the right move). Something to put far away in the todo list...
It's on my todo list and has been for a long time. But I'm moving it up close to the top because I AT LEAST want to understand exactly what is happening here since it could have a real impact on the strength of the program and also because many if not most Komodo users would want to see better behavior. As a Komodo user myself I don't like to see that.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Best was to Recognize Know Endgames?

Post by hgm »

syzygy wrote:Without special knowledge (and tablebases off) my engine takes 2 minutes to find a mate in 29 which then quickly goes down to mate in 21.

With special knowledge a mate in 25 is found in less than 8 seconds and mate in 21 in 14 seconds.
The "sepcial knowledge" here being that it would know which corner is the deadly one?
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Best was to Recognize Know Endgames?

Post by hgm »

Don wrote:There is some bug in Komodo that also makes it do that sort of thing. It will see a mate but report it as something like a mate taking 100 moves or more. I think it is a hash table interaction with the maximum mate depth Komodo can report - so with the hash table Komodo perhaps strings together a mate in some ridiculous number of ply and then moves on to the next iteration.

I see that here in this ending - so I have a good test case and I will try to fix this glitch. Because of aspiration at the root I will get fail high scores that look like modest wins similar to the 150 pawn score you see here.

Well, 100 moves or more is sort of normal, and should not bring you out of the range of mate scores. Even whnen you want scores to fit in 16 bits you should have plenty of room for a few thousand mate scores. It would be truly remarkable if Komodo could see mates in over a thousand moves.

What do you mean with "maximum mate depth Komodo can report"? Is that where it switches from mate to cp notation in the protocol driver? It should be pretty obvious whether a cp score was intended as a mate score, when you know the internal score Komodo uses for checkmate.

To get a score of 15093 cp, as we see here in Quazar, requires a really strange mate score, or an unbelievable DTM. So I still doubt it can have a similar explanation.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: Best was to Recognize Know Endgames?

Post by Don »

hgm wrote:
Don wrote:There is some bug in Komodo that also makes it do that sort of thing. It will see a mate but report it as something like a mate taking 100 moves or more. I think it is a hash table interaction with the maximum mate depth Komodo can report - so with the hash table Komodo perhaps strings together a mate in some ridiculous number of ply and then moves on to the next iteration.

I see that here in this ending - so I have a good test case and I will try to fix this glitch. Because of aspiration at the root I will get fail high scores that look like modest wins similar to the 150 pawn score you see here.

Well, 100 moves or more is sort of normal, and should not bring you out of the range of mate scores. Even whnen you want scores to fit in 16 bits you should have plenty of room for a few thousand mate scores. It would be truly remarkable if Komodo could see mates in over a thousand moves.

What do you mean with "maximum mate depth Komodo can report"? Is that where it switches from mate to cp notation in the protocol driver? It should be pretty obvious whether a cp score was intended as a mate score, when you know the internal score Komodo uses for checkmate.
If the score is high enough Komodo assumes it's a mate and converts it to mate score for UCI. In theory a score of 10 centipawns could be a mate in thousands of moves of course but no program would see those.

To get a score of 15093 cp, as we see here in Quazar, requires a really strange mate score, or an unbelievable DTM. So I still doubt it can have a similar explanation.
It can also be aspiration window glitches. It may be bounded by a window in other words.
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Best was to Recognize Know Endgames?

Post by hgm »

I guess you would have to use some form of fail-hard for window bounds to transfer back to scores. But would it really make sense to set one of the limits of an aspiration window at 150 Pawns?
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: A clarification

Post by syzygy »

sje wrote:A clarification:

As I see it, there are two distinct material distribution ideas presented here.

1. The material distribution key is produced by Zobrist hash construction.

2. The material distribution key is produced by adding or subtracting a single bit with the bit position defined by the piece being added or deleted.

Idea #1 allows the use of traditional transposition table techniques, but the key itself doesn't have any encoded data.

Idea #2 doesn't allow the key to be used as a transposition table index, but it does contain clearly identifiable and useful data.
A trivial modification to idea #2 does allow this, as already explained here.
A transposition table keyed by a material Zobrist key is much like a pawn structure table; both contain a lot of data which can be used not only from search to search, but also from game to game. Would it be worthwhile to save these tables after each program run and then reload them the next time around?
No, the hit rate is 99.9% so there is nothing to gain. (And if the hit rate were much lower there would still be nothing to gain.)
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: Best was to Recognize Know Endgames?

Post by syzygy »

hgm wrote:
syzygy wrote:Without special knowledge (and tablebases off) my engine takes 2 minutes to find a mate in 29 which then quickly goes down to mate in 21.

With special knowledge a mate in 25 is found in less than 8 seconds and mate in 21 in 14 seconds.
The "sepcial knowledge" here being that it would know which corner is the deadly one?
I have a bonus for getting the losing king closer to the right corner, and a penalty proportional to the distance between the two kings.
Don wrote:Here is a KBNvsK position that requires 33 moves, which is the longest this should take with perfect play:

[d]K1k1B3/8/8/8/8/8/7N/8 w - - 0 1

I'm going to run this overnight - it should take a lot longer than the last one took.

Don
On this position my engine without tablebases and without special heuristics starts to report impossibly large mate values after 25 seconds (due to TT interactions). Mate in 45 after 42 seconds, mate in 33 after 94 seconds.

With special heuristics for KBNK it takes 31 seconds to get a mate in 45 and 61 seconds to get to mate in 33. No impossibly large mate values.

Just for fun the two PVs I get:
1.Ka7 Kd8 2.Ba4 Kc7 3.Nf3 Kd6 4.Kb6 Kd5 5.Bc2 Kd6 6.Bb3 Kd7 7.Kc5 Ke7 8.Kd4 Kf6 9.Ke4 Kg6 10.Ke5 Kg7 11.Kf5 Kh6 12.Kf6 Kh7 13.Ne5 Kh8 14.Bc4 Kh7 15.Ng6 Kh6 16.Bg8 Kh5 17.Ne5 Kh4 18.Kf5 Kg3 19.Ng4 Kg2 20.Bc4 Kf3 21.Bb5 Kg3 22.Bc6 Kh3 23.Kf4 Kh4 24.Be8 Kh3 25.Ne3 Kh4 26.Ng2+ Kh3 27.Kf3 Kh2 28.Kf2 Kh3 29.Bd7+ Kh2 30.Ne3 Kh1 31.Bf5 Kh2 32.Nf1+ Kh1 33.Be4#

1.Ka7 Kd8 2.Bb5 Kc7 3.Nf3 Kd6 4.Kb6 Kd5 5.Bd3 Kd6 6.Bc4 Kd7 7.Kc5 Ke7 8.Kc6 Kf6 9.Kd6 Kf5 10.Bd3+ Kf6 11.Ne5 Kg7 12.Ke7 Kg8 13.Kf6 Kh8 14.Bc4 Kh7 15.Ng6 Kh6 16.Bg8 Kh5 17.Ne5 Kh4 18.Kf5 Kg3 19.Ng4 Kg2 20.Bc4 Kf3 21.Bd3 Kg3 22.Be2 Kh4 23.Nf2 Kg3 24.Nd3 Kh3 25.Kf4 Kh4 26.Ne1 Kh3 27.Bg4+ Kh2 28.Kf3 Kg1 29.Bh3 Kh2 30.Kg4 Kg1 31.Kg3 Kh1 32.Bg2+ Kg1 33.Nf3#
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Table persistancy across program restarts

Post by sje »

syzygy wrote:
sje wrote:A transposition table keyed by a material Zobrist key is much like a pawn structure table; both contain a lot of data which can be used not only from search to search, but also from game to game. Would it be worthwhile to save these tables after each program run and then reload them the next time around?
No, the hit rate is 99.9% so there is nothing to gain. (And if the hit rate were much lower there would still be nothing to gain.)
Actually, the higher the hit rate, then the more the gain. A more complete analysis would cover the per entry generation time and the whole table save/restore time.
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Best was to Recognize Know Endgames?

Post by michiguel »

michiguel wrote:
Don wrote:Actually, this took less than 5 minutes to solve too.
Don wrote:Here is a KBNvsK position that requires 33 moves, which is the longest this should take with perfect play:

[d]K1k1B3/8/8/8/8/8/7N/8 w - - 0 1

I'm going to run this overnight - it should take a lot longer than the last one took.

Don
I let Gaviota run on this position (AMD Phenom(tm) II X4 965 Processor × 4 3.4 Ghz), hash = 4 Gb, of course, no TBs.

After 2 min 40 seconds (160.0 s in this log) a mate is announced

Code: Select all

333150264  35     144.5    +5.85  1.Bh5 Kd7 2.Ng4 Ke6 3.Ne3 Ke5 4.Nc2 Ke4
                                   5.Kb7 Ke5 6.Kc6 Ke4 7.Kc5 Ke5 8.Nd4 Kf6
                                   9.Kd6 Kg7 10.Nf5+ Kf6 11.Ne7 Kg7 12.Ke5
                                   Kh8 13.Kf6 Kh7 14.Bf7 Kh8 15.Ng6+ Kh7
                                   16.Kg5 Kg7 17.Bb3 Kh7 18.Kf6 Kh6 19.Nf8
                                   [>]
 354260831  35     153.9      :-)  1.Bb5
 354264379  35     153.9      :-)  1.Bb5
 364415388  35     160.0  +Mat_69  1.Bb5 Kc7 2.Ka7 Kd6 3.Kb6 Kd5 4.Bc6+
                                   Kd4 5.Nf3+ Kc4 6.Be4 Kb3 7.Ne5 Kc3
                                   8.Kc5 Kb3 9.Kd4 Kb2 10.Kc4 Ka2 11.Kc3
                                   Ka1 12.Ng4 Ka2 13.Bd3 Ka1 14.Ba6 Ka2
                                   15.Kc2 Ka3 16.Kc3 [>]
At depth 45, ~16 minutes, a mate under 50 is announced.

Code: Select all

2158546628  45     981.1  +Mat_39  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Ke6 4.Be4 Ke7
                                   5.Kb6 Kd6 6.Kb5 Ke7 7.Kc6 Ke6 8.Bg6 Ke7
                                   9.Kd5 Kf8 10.Ke6 Kg7 11.Bb1 Kg8 12.Kf6
                                   Kh8 13.Ba2 Kh7 14.Ne5 Kh8 15.Ng6+ Kh7
                                   16.Bb1 Kg8 17.Ba2+ [>]
At depth 60, ~98 min, finally mate in 33 is announced.

Code: Select all

12212789059  60    5902.6  +Mat_33  1.Bg6 Kd7 2.Kb7 Ke6 3.Kc6 Ke5 4.Bb1 Kd4
                                   5.Nf3+ Ke3 6.Ng5 Kd4 7.Ne6+ Ke5 8.Kd7
                                   Kf6 9.Kd6 Kf7 10.Ke5 Ke7 11.Ng5 Kf8
                                   12.Kf6 Ke8 13.Bf5 Kf8 14.Be6 Ke8 15.Nf7
                                   Kf8 16.Ne5 Ke8 17.Bf7+ Kd8 18.Ke6 Kc7
                                   19.Be8 Kb6 20.Kd6 Ka5 21.Kc5 Ka6 22.Nc6
                                   Kb7 23.Nd8+ Kc7 24.Nf7 Kb7 25.Kb5 Kc7
                                   26.Ka6 Kc8 27.Kb6 Kb8 28.Bd7 Ka8 29.Bb5
                                   Kb8 30.Ba6 Ka8 31.Ne5 [>]
12218733597  60:   5905.7  +Mat_33  1.Bg6 Kd7 2.Kb7 Ke6 3.Kc6 Ke5 4.Bb1 Kd4
                                   5.Nf3+ Ke3 6.Ng5 Kd4 7.Ne6+ Ke5 8.Kd7
                                   Kf6 9.Kd6 Kf7 10.Ke5 Ke7 11.Ng5 Kf8
                                   12.Kf6 Ke8 13.Bf5 Kf8 14.Be6 Ke8 15.Nf7
                                   Kf8 16.Ne5 Ke8 17.Bf7+ Kd8 18.Ke6 Kc7
                                   19.Be8 Kb6 20.Kd6 Ka5 21.Kc5 Ka6 22.Nc6
                                   Kb7 23.Nd8+ Kc7 24.Nf7 Kb7 25.Kb5 Kc7
                                   26.Ka6 Kc8 27.Kb6 Kb8 28.Bd7 Ka8 29.Bb5
                                   Kb8 30.Ba6 Ka8 31.Ne5 [>]
12232467096  61    5917.9  +Mat_33  1.Bg6 Kd7 2.Kb7 Ke6 3.Kc6 Ke5 4.Bb1 Kd4
                                   5.Kd6 Kc4 6.Nf3 Kb4 7.Kd5 Kc3 8.Nd4 Kb2
                                   9.Bh7 Kc3 10.Kc5 Kb2 11.Kc4 Ka1 12.Kc3
                                   Ka2 13.Nb3 Ka3 14.Bb1 Ka4 15.Nd4 Ka5
                                   16.Kc4 Kb6 17.Nb5 Kb7 18.Bf5 Kc6 19.Be6
                                   Kb6 20.Bd7 Ka5 21.Nc7 Kb6 22.Ne8 Ka5
                                   23.Kc5 Ka6 24.Nd6 Ka5 25.Bc6 Ka6
                                   26.Bb5+ Ka7 27.Kc6 Kb8 28.Ba6 Ka7
                                   29.Bf1 Kb8 30.Kb6 Ka8 &#91;<&#93;
12235965572  61&#58;   5919.8  +Mat_33  1.Bg6 Kd7 2.Kb7 Ke6 3.Kc6 Ke5 4.Bb1 Kd4
                                   5.Kd6 Kc4 6.Nf3 Kb4 7.Kd5 Kc3 8.Nd4 Kb2
                                   9.Bh7 Kc3 10.Kc5 Kb2 11.Kc4 Ka1 12.Kc3
                                   Ka2 13.Nb3 Ka3 14.Bb1 Ka4 15.Nd4 Ka5
                                   16.Kc4 Kb6 17.Nb5 Kb7 18.Bf5 Kc6 19.Be6
                                   Kb6 20.Bd7 Ka5 21.Nc7 Kb6 22.Ne8 Ka5
                                   23.Kc5 Ka6 24.Nd6 Ka5 25.Bc6 Ka6
                                   26.Bb5+ Ka7 27.Kc6 Kb8 28.Ba6 Ka7
                                   29.Bf1 Kb8 30.Kb6 Ka8 &#91;<&#93;

Miguel
I managed to improve this significantly with the following two changes
1) entries with mate values take priority in the hash table
2) Do not do LMR if beta is in the mate value range, that is, no reason to reduce when all moves lead to a checkmate.

1 --> makes sure mates are not overwritten in the hashtable
and 2 avoids the annoying jumping up and down in mate scores reported.

with that i got a mate in 2 min 20 sec, and mate it 33 in 5 min 20 sec.

Code: Select all

 311424055  38     139.1    +5.87  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Ke6 4.Be4 Kf7
                                   5.Bd5+ Ke7 6.Bg8 Kf8 7.Ba2 Kg7 8.Kb7
                                   Kg6 9.Be6 Kg7 10.Kc7 Kg6 11.Kd6 Kg7
                                   12.Ke5 Kh8 13.Ba2 Kg7 14.Kf5 Kh8 15.Bd5
                                   Kg7 16.Kg5 Kh8 17.Ne5 Kg7 18.Ng6 Kh7
                                   19.Kf6 Kh6 &#91;<&#93;
 312809654  38&#58;    139.9    +5.87  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Ke6 4.Be4 Kf7
                                   5.Bd5+ Ke7 6.Bg8 Kf8 7.Ba2 Kg7 8.Kb7
                                   Kg6 9.Be6 Kg7 10.Kc7 Kg6 11.Kd6 Kg7
                                   12.Ke5 Kh8 13.Ba2 Kg7 14.Kf5 Kh8 15.Bd5
                                   Kg7 16.Kg5 Kh8 17.Ne5 Kg7 18.Ng6 Kh7
                                   19.Kf6 Kh6 &#91;<&#93;
 314212353  39     140.7      &#58;-)  1.Ka7
 363450897  39     165.3  +Mat_60  1.Ka7 Kd8 2.Ba4 Ke7 3.Kb6 Kd6 4.Kb5 Kd5
                                   5.Bb3+ Kd4 6.Nf3+ Ke4 7.Ng5+ Ke5 8.Nf7+
                                   Kf5 9.Kc5 Kg6 10.Kc6 Kf6 11.Kd6 Kg7
                                   12.Ke7 Kh7 13.Kf6 Kg8 14.Bc2 Kf8 &#91;TT&#93;
 369154219  39     168.6  +Mat_59  1.Ng4 Kd8 2.Bg6 Kc7 3.Be4 &#91;TT&#93;
 375501297  39     172.3  +Mat_57  1.Bb5 Kc7 2.Ka7 Kd6 3.Kb6 Kd5 4.Ng4 Kd4
                                   5.Kc6 &#91;TT&#93;
 379021642  39&#58;    174.1  +Mat_57  1.Bb5 Kc7 2.Ka7 Kd6 3.Kb6 Kd5 4.Ng4 Kd4
                                   5.Kc6 &#91;TT&#93;
 382716394  40     176.6  +Mat_54  1.Bb5 Kc7 2.Ka7 Kd6 3.Kb6 Kd5 4.Bc6+
                                   Kd4 5.Nf3+ Kd3 6.Kc5 Ke3 7.Kc4 Kf4
                                   8.Kd4 Kf5 9.Bd5 Kf6 10.Ke4 Kg6 11.Ke5
                                   Kg7 12.Kf5 Kh8 13.Ng5 Kg7 14.Nf7 Kh7
                                   &#91;TT&#93;
 388808840  40     180.2  +Mat_52  1.Ka7 Kc7 2.Ng4 Kd8 3.Bg6 Kc7 4.Be4 Kd7
                                   5.Kb6 Kd6 6.Kb5 Ke6 7.Kc6 Ke7 8.Bd5 Kf8
                                   9.Kd7 Kg7 10.Be4 Kg8 11.Ne5 Kf8 12.Bd5
                                   Kg7 13.Ke7 Kh8 14.Kf6 Kh7 15.Nf7 Kg8
                                   16.Kg6 Kf8 &#91;TT&#93;
 390087515  40&#58;    181.0  +Mat_52  1.Ka7 Kc7 2.Ng4 Kd8 3.Bg6 Kc7 4.Be4 Kd7
                                   5.Kb6 Kd6 6.Kb5 Ke6 7.Kc6 Ke7 8.Bd5 Kf8
                                   9.Kd7 Kg7 10.Be4 Kg8 11.Ne5 Kf8 12.Bd5
                                   Kg7 13.Ke7 Kh8 14.Kf6 Kh7 15.Nf7 Kg8
                                   16.Kg6 Kf8 &#91;TT&#93;
 395941140  41     184.7  +Mat_43  1.Ka7 Kc7 2.Nf3 Kd8 3.Bg6 Kc7 4.Be4 Kd7
                                   5.Kb6 Kd6 6.Kb5 &#91;TT&#93;
 397805105  41&#58;    185.7  +Mat_43  1.Ka7 Kc7 2.Nf3 Kd8 3.Bg6 Kc7 4.Be4 Kd7
                                   5.Kb6 Kd6 6.Kb5 &#91;TT&#93;
 418827078  42     195.7  +Mat_43  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Be4 Ke6 &#91;TT&#93;
 424883519  42&#58;    199.1  +Mat_43  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Be4 Ke6 &#91;TT&#93;
 427047975  43     200.4  +Mat_43  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Be4 Ke6 &#91;TT&#93;
 432164525  43&#58;    203.1  +Mat_43  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Be4 Ke6 &#91;TT&#93;
 434234911  44     204.4  +Mat_42  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Nd4 Kd5 7.Nc6 Ke6 8.Kc5 Kf6
                                   9.Kd6 Kf7 10.Ke5 Kg7 11.Ke6 Kh8 12.Kf6
                                   Kg8 13.Ne5 Kh8 14.Bc2 Kg8 15.Nf7 Kf8
                                   16.Bh7 Ke8 &#91;TT&#93;
 437005254  44&#58;    205.9  +Mat_42  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Nd4 Kd5 7.Nc6 Ke6 8.Kc5 Kf6
                                   9.Kd6 Kf7 10.Ke5 Kg7 11.Ke6 Kh8 12.Kf6
                                   Kg8 13.Ne5 Kh8 14.Bc2 Kg8 15.Nf7 Kf8
                                   16.Bh7 Ke8 &#91;TT&#93;
 438966042  45     207.1  +Mat_42  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Nd4 Kd5 7.Nc6 Ke6 8.Kc5 Kf6
                                   9.Kd6 Kf7 10.Ke5 Kg7 11.Ke6 Kh8 12.Kf6
                                   Kg8 13.Nd8 Kh8 14.Bc2 Kg8 15.Nf7 Kf8
                                   &#91;TT&#93;
 442367932  45&#58;    209.1  +Mat_42  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Nd4 Kd5 7.Nc6 Ke6 8.Kc5 Kf6
                                   9.Kd6 Kf7 10.Ke5 Kg7 11.Ke6 Kh8 12.Kf6
                                   Kg8 13.Nd8 Kh8 14.Bc2 Kg8 15.Nf7 Kf8
                                   &#91;TT&#93;
 459039438  46     217.9  +Mat_39  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Kf7 4.Be4 Ke6
                                   5.Kb6 Kd6 6.Kb5 Ke7 7.Kc6 Ke6 8.Bg6 Ke7
                                   9.Kd5 Kf8 10.Ke6 Kg7 11.Bb1 Kh8 12.Kf6
                                   Kg8 13.Nh6+ Kf8 14.Nf7 Kg8 15.Be4 Kf8
                                   &#91;TT&#93;
 461793386  46&#58;    219.5  +Mat_39  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Kf7 4.Be4 Ke6
                                   5.Kb6 Kd6 6.Kb5 Ke7 7.Kc6 Ke6 8.Bg6 Ke7
                                   9.Kd5 Kf8 10.Ke6 Kg7 11.Bb1 Kh8 12.Kf6
                                   Kg8 13.Nh6+ Kf8 14.Nf7 Kg8 15.Be4 Kf8
                                   &#91;TT&#93;
 463579775  47     220.6  +Mat_39  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Kf7 4.Be4 Ke6
                                   5.Kb6 Kd6 6.Kb5 Ke7 7.Kc6 Ke6 8.Bg6 Ke7
                                   9.Kd5 Kf8 10.Ke6 Kg7 11.Bb1 Kh8 12.Kf6
                                   Kg8 13.Nh6+ Kf8 14.Nf7 Kg8 15.Be4 Kf8
                                   &#91;TT&#93;
 466585707  47&#58;    222.2  +Mat_39  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Kf7 4.Be4 Ke6
                                   5.Kb6 Kd6 6.Kb5 Ke7 7.Kc6 Ke6 8.Bg6 Ke7
                                   9.Kd5 Kf8 10.Ke6 Kg7 11.Bb1 Kh8 12.Kf6
                                   Kg8 13.Nh6+ Kf8 14.Nf7 Kg8 15.Be4 Kf8
                                   &#91;TT&#93;
 468734770  48     223.5  +Mat_39  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Kf7 4.Be4 Ke6
                                   5.Kb6 Kd6 6.Kb5 Ke7 7.Kc6 Ke6 8.Bg6 Ke7
                                   9.Kd5 Kf8 10.Ke6 Kg7 11.Bc2 Kh8 12.Ne5
                                   Kg7 13.Nf7 Kg8 14.Kf6 Kf8 &#91;TT&#93;
 471910346  48&#58;    225.3  +Mat_39  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Kf7 4.Be4 Ke6
                                   5.Kb6 Kd6 6.Kb5 Ke7 7.Kc6 Ke6 8.Bg6 Ke7
                                   9.Kd5 Kf8 10.Ke6 Kg7 11.Bc2 Kh8 12.Ne5
                                   Kg7 13.Nf7 Kg8 14.Kf6 Kf8 &#91;TT&#93;
 475290818  49     227.3  +Mat_39  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Kf7 4.Be4 Ke6
                                   5.Kb6 Kd6 6.Kb5 Kd7 7.Kc5 Ke6 8.Kc6 Ke7
                                   9.Kd5 Kf7 10.Kd6 Kg8 11.Ke6 Kg7 &#91;TT&#93;
 483987333  49&#58;    232.1  +Mat_39  1.Ka7 Kd8 2.Bc6 Ke7 3.Ng4 Kf7 4.Be4 Ke6
                                   5.Kb6 Kd6 6.Kb5 Kd7 7.Kc5 Ke6 8.Kc6 Ke7
                                   9.Kd5 Kf7 10.Kd6 Kg8 11.Ke6 Kg7 &#91;TT&#93;
 572608341  50     273.6  +Mat_36  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Bc4 Ke7 7.Kc5 Kf6 8.Bd3 Kg7
                                   9.Ne5 Kg8 10.Kd5 Kh8 11.Kd6 Kg7 12.Ke6
                                   Kh8 &#91;TT&#93;
 579117277  50&#58;    277.3  +Mat_36  1.Ka7 Kd8 2.Bb5 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bd3 Kd6 6.Bc4 Ke7 7.Kc5 Kf6 8.Bd3 Kg7
                                   9.Ne5 Kg8 10.Kd5 Kh8 11.Kd6 Kg7 12.Ke6
                                   Kh8 &#91;TT&#93;
 607593285  51     293.1  +Mat_34  1.Ka7 Kd8 2.Ba4 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bc2 Kc4 6.Kc6 Kc3 7.Bb1 Kb2 8.Bh7 Kc3
                                   9.Kc5 Kb3 10.Nd4+ Kc3 11.Bc2 Kb2 12.Kb4
                                   Ka2 13.Kc3 Ka1 14.Bb3 Kb1 15.Nc2 Kc1
                                   16.Ba2 Kd1 17.Nd4 Ke1 18.Kd3 Kf2 19.Ne2
                                   Kg2 20.Be6 Kf3 21.Bh3 Kf2 22.Bg4 Ke1
                                   23.Ke3 Kd1 24.Bf5 Ke1 25.Bc2 Kf1 &#91;TT&#93;
 615000191  51&#58;    297.2  +Mat_34  1.Ka7 Kd8 2.Ba4 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bc2 Kc4 6.Kc6 Kc3 7.Bb1 Kb2 8.Bh7 Kc3
                                   9.Kc5 Kb3 10.Nd4+ Kc3 11.Bc2 Kb2 12.Kb4
                                   Ka2 13.Kc3 Ka1 14.Bb3 Kb1 15.Nc2 Kc1
                                   16.Ba2 Kd1 17.Nd4 Ke1 18.Kd3 Kf2 19.Ne2
                                   Kg2 20.Be6 Kf3 21.Bh3 Kf2 22.Bg4 Ke1
                                   23.Ke3 Kd1 24.Bf5 Ke1 25.Bc2 Kf1 &#91;TT&#93;
 617222187  52     298.7  +Mat_34  1.Ka7 Kd8 2.Ba4 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bc2 Kd6 6.Be4 Ke7 7.Kc5 Ke6 8.Kc6 Kf7
                                   &#91;TT&#93;
 628746746  52&#58;    304.8  +Mat_34  1.Ka7 Kd8 2.Ba4 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bc2 Kd6 6.Be4 Ke7 7.Kc5 Ke6 8.Kc6 Kf7
                                   &#91;TT&#93;
 663898666  53     319.9  +Mat_33  1.Ka7 Kd8 2.Ba4 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Bc2 Kd6 6.Be4 Ke7 7.Kc5 Ke6 8.Kc6 Kf7
                                   9.Kd7 Kf6 10.Kd6 Kg7 11.Ke7 Kh8 12.Ne5
                                   Kg7 13.Nf7 Kg8 14.Kf6 Kf8 15.Bh7 Ke8
                                   16.Ne5 Kd8 17.Ke6 Kc7 18.Nd7 Kb7 19.Bd3
                                   Kc6 20.Bc4 Kc7 21.Bb5 Kd8 22.Kd6 Ke8
                                   23.Bc4 Kd8 24.Bf7 Kc8 &#91;TT&#93;
And the mate in 33 stays stable until ply 64, which is the maximum Gaviota can search.

Code: Select all

 849809506  64&#58;    413.0  +Mat_33  1.Ka7 Kd8 2.Bg6 Ke7 3.Kb6 Kd6 4.Nf3 Kd5
                                   5.Kc7 Kc5 6.Be4 Kb4 7.Kb6 Kc4 8.Kc6 Kb3
                                   9.Kb5 Kc3 10.Kc5 Kb2 11.Kb4 Ka1 12.Nd4
                                   Ka2 13.Kc3 Ka1 14.Bc2 Ka2 15.Nb3 Ka3
                                   16.Bb1 Ka4 &#91;TT&#93;
Miguel
User avatar
michiguel
Posts: 6401
Joined: Thu Mar 09, 2006 8:30 pm
Location: Chicago, Illinois, USA

Re: Best was to Recognize Know Endgames?

Post by michiguel »

syzygy wrote:
hgm wrote:
syzygy wrote:Without special knowledge (and tablebases off) my engine takes 2 minutes to find a mate in 29 which then quickly goes down to mate in 21.

With special knowledge a mate in 25 is found in less than 8 seconds and mate in 21 in 14 seconds.
The "sepcial knowledge" here being that it would know which corner is the deadly one?
I have a bonus for getting the losing king closer to the right corner, and a penalty proportional to the distance between the two kings.
Don wrote:Here is a KBNvsK position that requires 33 moves, which is the longest this should take with perfect play:

[d]K1k1B3/8/8/8/8/8/7N/8 w - - 0 1

I'm going to run this overnight - it should take a lot longer than the last one took.

Don
On this position my engine without tablebases and without special heuristics starts to report impossibly large mate values after 25 seconds (due to TT interactions). Mate in 45 after 42 seconds, mate in 33 after 94 seconds.

With special heuristics for KBNK it takes 31 seconds to get a mate in 45 and 61 seconds to get to mate in 33. No impossibly large mate values.
That is very impressive.

Miguel
Just for fun the two PVs I get:
1.Ka7 Kd8 2.Ba4 Kc7 3.Nf3 Kd6 4.Kb6 Kd5 5.Bc2 Kd6 6.Bb3 Kd7 7.Kc5 Ke7 8.Kd4 Kf6 9.Ke4 Kg6 10.Ke5 Kg7 11.Kf5 Kh6 12.Kf6 Kh7 13.Ne5 Kh8 14.Bc4 Kh7 15.Ng6 Kh6 16.Bg8 Kh5 17.Ne5 Kh4 18.Kf5 Kg3 19.Ng4 Kg2 20.Bc4 Kf3 21.Bb5 Kg3 22.Bc6 Kh3 23.Kf4 Kh4 24.Be8 Kh3 25.Ne3 Kh4 26.Ng2+ Kh3 27.Kf3 Kh2 28.Kf2 Kh3 29.Bd7+ Kh2 30.Ne3 Kh1 31.Bf5 Kh2 32.Nf1+ Kh1 33.Be4#

1.Ka7 Kd8 2.Bb5 Kc7 3.Nf3 Kd6 4.Kb6 Kd5 5.Bd3 Kd6 6.Bc4 Kd7 7.Kc5 Ke7 8.Kc6 Kf6 9.Kd6 Kf5 10.Bd3+ Kf6 11.Ne5 Kg7 12.Ke7 Kg8 13.Kf6 Kh8 14.Bc4 Kh7 15.Ng6 Kh6 16.Bg8 Kh5 17.Ne5 Kh4 18.Kf5 Kg3 19.Ng4 Kg2 20.Bc4 Kf3 21.Bd3 Kg3 22.Be2 Kh4 23.Nf2 Kg3 24.Nd3 Kh3 25.Kf4 Kh4 26.Ne1 Kh3 27.Bg4+ Kh2 28.Kf3 Kg1 29.Bh3 Kh2 30.Kg4 Kg1 31.Kg3 Kh1 32.Bg2+ Kg1 33.Nf3#