DTM50

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: DTM50

Post by syzygy »

Andrew wrote: Thu May 02, 2019 11:09 am For example look at the various arves files https://rybkaforum.net/cgi-bin/rybkafor ... ?tid=32814

A lot of these positions are easy to get a TB mate score, but a mate distance is much harder.
[D]4BQ2/1r3P2/4Pk2/5P1q/8/p7/P7/K7 w - - 0 1
With 6-piece TBs and 5-piece DTM:

Code: Select all

info depth 32 seldepth 46 multipv 1 score mate 60 lowerbound nodes 74599512 nps 10951190 hashfull 41 tbhits 1028941 time 6812 pv f8g7
info depth 32 seldepth 46 multipv 1 score mate 45 lowerbound nodes 77616398 nps 10918047 hashfull 42 tbhits 1107966 time 7109 pv f8g7
info depth 32 seldepth 46 multipv 1 score mate 36 nodes 97059343 nps 10694065 hashfull 55 tbhits 1509020 time 9076 pv f8g7 f6g7 f5f6 g7g6 f7f8q g6h7 f8h8 h7h8 e8h5 b7c7 a1b1 c7b7 b1c1 b7c7 c1d2 c7c5 e6e7 c5d5 d2c1 d5c5 c1b1 c5b5 b1a1 b5g5 e7e8q h8h7 e8f7 h7h8 f7g7 g5g7 f6g7 h8g8 h5g4 g8g7 g4e2 g7f6 a1b1 f6e5 b1c2 e5d4 c2b3 d4d5 b3a3 d5c5 e2f1 c5d6 a3b4 d6e7 a2a4 e7d6 a4a5 d6d5 f1g2 d5e6 a5a6 e6f7 a6a7 f7e6 a7a8q e6f7 g2e4 f7e6 a8f8 e6d7 e4d5 d7c7 f8e7 c7c8 d5h1 c8b8 e7b7
info depth 33 seldepth 33 multipv 1 score mate 29 nodes 107010747 nps 10721445 hashfull 58 tbhits 1718067 time 9981 pv f8g7 f6g7 f5f6 g7h7 f7f8n h7h8 e8h5 b7b5 h5g6 b5e5 f8d7 e5e6 f6f7 e6e1 g6b1 e1f1 f7f8q f1f8 d7f8 h8g7 f8e6 g7f7 e6c7 f7e7 c7b5 e7d7 b5a3 d7c6 b1d3 c6d7 a3c2 d7c6 a2a4 c6d7 a4a5 d7c6 a5a6 c6b6 a1a2 b6c7 a2b3 c7b6 b3b4 b6c7 b4c5 c7d8 a6a7 d8c7 a7a8q c7d7 c2e3 d7e7 e3d5 e7f7 a8h8 f7e6 h8e8
info depth 47 seldepth 49 multipv 1 score mate 28 nodes 250590540 nps 9993640 hashfull 107 tbhits 4909071 time 25075 pv f8g7 f6g7 f5f6 g7h7 f7f8n h7h6 e8h5 b7b6 h5g6 b6e6 f8e6 h6g6 e6d4 g6f6 d4c2 f6e5 c2a3 e5d4 a1b2 d4d5 b2b3 d5c5 a3c4 c5b5 a2a3 b5c6 b3b4 c6d7 a3a4 d7c6 a4a5 c6d7 b4b5 d7c7 a5a6 c7b8 c4d6 b8a7 d6e8 a7b8 b5b6 b8c8 a6a7 c8d8 a7a8q d8e7 a8g2 e7e6 g2g5 e6f7 b6c6 f7f8 c6d7 f8f7 g5g7
info depth 49 seldepth 39 multipv 1 score mate 27 nodes 320510315 nps 10294212 hashfull 136 tbhits 6356974 time 31135 pv f8g7 f6g7 f5f6 g7h7 f7f8n h7g8 e8h5 b7c7 a1b1 c7b7 b1c1 b7c7 c1d2 g8f8 e6e7 c7e7 f6e7 f8e7 h5e2 e7d6 d2c2 d6c5 c2b3 c5d6 b3a3 d6c5 e2f1 c5d6 a3b4 d6e7 a2a4 e7d6 a4a5 d6d5 f1g2 d5e6 a5a6 e6f7 a6a7 f7e6 a7a8q e6f7 g2e4 f7e6 a8f8 e6d7 e4d5 d7c7 f8e7 c7c8 d5h1 c8b8 e7b7
info depth 57 seldepth 41 multipv 1 score mate 25 nodes 446764167 nps 9719448 hashfull 186 tbhits 9183029 time 45966 pv f8g7 f6g7 f5f6 g7h7 f7f8n h7g8 e8h5 b7c7 a1b1 g8f8 e6e7 c7e7 f6e7 f8e7 h5e2 e7d6 b1c2 d6c5 c2b3 c5d6 b3a3 d6c5 e2f1 c5d6 a3b4 d6e7 a2a4 e7d6 a4a5 d6d5 f1g2 d5e6 a5a6 e6f7 a6a7 f7e6 a7a8q e6f7 g2e4 f7e6 a8f8 e6d7 e4d5 d7c7 f8e7 c7c8 d5h1 c8b8 e7b7
Still mate 25 at depth 77.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: DTM50

Post by hgm »

I don't understand this obsession with finding the fastest mate. An EGT that lists DTM through paths that respect the 50-move rule when entered with the ply counter at zero should not be larger than one that ignores the 50-move rule altogether. And in cases where you do not enter the EGT in a won position, or did not play perfectly ever since, you just play by DTC until the next conversion, to reset the ply counter as quickly as you can. The only realistic case where this happens is when you enter the EGT in a drawn position, and after having driven up the ply counter the opponent blunders. If the opponent doesn't play perfectly, why should you?
syzygy
Posts: 5557
Joined: Tue Feb 28, 2012 11:56 pm

Re: DTM50

Post by syzygy »

hgm wrote: Thu May 02, 2019 11:05 pm I don't understand this obsession with finding the fastest mate. An EGT that lists DTM through paths that respect the 50-move rule when entered with the ply counter at zero should not be larger than one that ignores the 50-move rule altogether.
I suppose these are two entirely separate remarks?

As you are aware (see the top two posts), a tablebase that only lists DTM50 when entered with the ply counter at zero cannot reliably be used to find moves when the ply counter is larger than zero. So you won't be able to play perfectly.

Of course if you are happy with just knowing the mate value and don't care about actually converting the mate in the number of moves announced, then the simple approach is fine.
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: DTM50

Post by Dann Corbit »

hgm wrote: Thu May 02, 2019 11:05 pm I don't understand this obsession with finding the fastest mate. An EGT that lists DTM through paths that respect the 50-move rule when entered with the ply counter at zero should not be larger than one that ignores the 50-move rule altogether. And in cases where you do not enter the EGT in a won position, or did not play perfectly ever since, you just play by DTC until the next conversion, to reset the ply counter as quickly as you can. The only realistic case where this happens is when you enter the EGT in a drawn position, and after having driven up the ply counter the opponent blunders. If the opponent doesn't play perfectly, why should you?
For beauty
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.
jdart
Posts: 4366
Joined: Fri Mar 10, 2006 5:23 am
Location: http://www.arasanchess.org

Re: DTM50

Post by jdart »

When I was studying high-school geometry, I remember I wasn't told, or at least not right away, that a short simple proof is preferable to a long, complex one. So I'd sometimes come up with a long, complex one. It wasn't incorrect but it wasn't elegant, either. This is kind of like that.

--Jon
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: DTM50

Post by hgm »

syzygy wrote: Thu May 02, 2019 11:39 pmAs you are aware (see the top two posts), a tablebase that only lists DTM50 when entered with the ply counter at zero cannot reliably be used to find moves when the ply counter is larger than zero. So you won't be able to play perfectly.
Of course. This is why I say one should play by DTC50 when you enter the won sector of the EGT with a non-zero ply counter.

As to the simple vs complex proof, I see it just the opposite way: just having two prescriptions for how to play, depending on whether you are in a hurry or not, I would call simple. Having 99 descriptions, depending on how much in a hurry you exactly are, for the only purpose to squeeze out some extra plies in cases that in practice are extremely unlikely to occur, seems hopelessly complex, and certainly not an elegant solution (*).

So, no, they were not really independent remarks. Wanting to squeeze out those extra plies under conditions that are mostly hypothetical can be very well described as an obsession.

There doesn't seem much beauty in having to wait for the opponent to blunder in a drawn position, and then achieve the mate a few moves faster. Or first waste a number of moves in a won position before you suddenly start to worry about achieving the mate unnecessarily fast (50-move-wise). Sounds more like an embarrassment to me.

*) This reminds me of a joke I once heard parodyzing the mode of operation of professional mathematicians:
Q: "How does a mathematician brew tea?"
A: "He takes the tea pot from the cupboard, puts it on the table, scoops in tea and poors on water."
Q: "But what if the tea pot is already on the table?"
A: "Then he puts it back into the cupboard first, to reduce it to a known problem!"
So much for elegance...
Andrew
Posts: 231
Joined: Thu Mar 09, 2006 12:51 am
Location: Australia

Re: DTM50

Post by Andrew »

I'm interested in getting lower mates scores for puzzles etc, not during game play.

A lot of the positions in the Arves files I mentioned earlier have mate scores on them that I think could be
improved on substantially. E.g: Arves 3517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Kb4 Ke7 2.Kc3 Kf6 3.Kd2 Kg6 4.Kc2 Kf6 5.Kc3 Kg6 6.Kc4 Kf6 7.d5 Ke7 8.dxc6 Kf6 9.Kd4 Kf5 10.Kd5 Kf6 11.Ke4 Kg6 12.Kxf4 Kf6 13.Ke4 Kg6 14.Ke5 Kf7 15.Kf5 Ke7 16.f4 Kf7 17.Kg5 Ke6 18.f5+ Ke5 19.f6 Ke6 20.Kg6 Kd5 21.f7 Kxc6 22.Kxh5 Kd5 23.Kg6 Kd4 24.f8Q Ke3 25.h5 Kd2 26.h6 Kc3 27.h7 Kb4 28.h8Q Kc4 29.Qf4+ Kxc5 30.Qxc7+ Kb4 31.Qhb8+ Ka4 32.Qca7#
+- (#32) Depth: 63/74 00:19:25 13207MN, tb=709578454
1.Kb4 Ke7 2.Kc3 Kf6 3.Kd2 Kg6 4.Kc2 Kf6 5.Kc3 Kg6 6.Kc4 Kf6 7.d5 Ke7 8.dxc6 Ke6 9.Kd4 Kf5 10.Kd5 Kf6 11.Ke4 Kg6 12.Kxf4 Kf6 13.Ke4 Kg6 14.f4 Kf6 15.f5 Kf7 16.Ke5 Ke7 17.f6+ Kf8 18.Ke6 Ke8 19.f7+ Kf8 20.Kd7 Kxf7 21.Kxc7 Ke6 22.Kb6 Ke7 23.c7 Kd7 24.Kb7 Ke6 25.c8Q+ Kd5 26.c6 Ke4 27.Qf8 Kd4 28.c7 Kc4 29.c8Q+ Kb3 30.Qh3+ Kb2 31.Qf2+ Kc1 32.Qhf1#
+- (#32) Depth: 64/64 00:19:34 13285MN, tb=714850242

With DTM it might be able to get these quicker?

Andrew
Andrew
Posts: 231
Joined: Thu Mar 09, 2006 12:51 am
Location: Australia

Re: DTM50

Post by Andrew »

syzygy wrote: Thu May 02, 2019 10:23 pm
Andrew wrote: Thu May 02, 2019 11:09 am For example look at the various arves files https://rybkaforum.net/cgi-bin/rybkafor ... ?tid=32814

A lot of these positions are easy to get a TB mate score, but a mate distance is much harder.
[D]4BQ2/1r3P2/4Pk2/5P1q/8/p7/P7/K7 w - - 0 1
With 6-piece TBs and 5-piece DTM:

Code: Select all

info depth 32 seldepth 46 multipv 1 score mate 60 lowerbound nodes 74599512 nps 10951190 hashfull 41 tbhits 1028941 time 6812 pv f8g7
info depth 32 seldepth 46 multipv 1 score mate 45 lowerbound nodes 77616398 nps 10918047 hashfull 42 tbhits 1107966 time 7109 pv f8g7
info depth 32 seldepth 46 multipv 1 score mate 36 nodes 97059343 nps 10694065 hashfull 55 tbhits 1509020 time 9076 pv f8g7 f6g7 f5f6 g7g6 f7f8q g6h7 f8h8 h7h8 e8h5 b7c7 a1b1 c7b7 b1c1 b7c7 c1d2 c7c5 e6e7 c5d5 d2c1 d5c5 c1b1 c5b5 b1a1 b5g5 e7e8q h8h7 e8f7 h7h8 f7g7 g5g7 f6g7 h8g8 h5g4 g8g7 g4e2 g7f6 a1b1 f6e5 b1c2 e5d4 c2b3 d4d5 b3a3 d5c5 e2f1 c5d6 a3b4 d6e7 a2a4 e7d6 a4a5 d6d5 f1g2 d5e6 a5a6 e6f7 a6a7 f7e6 a7a8q e6f7 g2e4 f7e6 a8f8 e6d7 e4d5 d7c7 f8e7 c7c8 d5h1 c8b8 e7b7
info depth 33 seldepth 33 multipv 1 score mate 29 nodes 107010747 nps 10721445 hashfull 58 tbhits 1718067 time 9981 pv f8g7 f6g7 f5f6 g7h7 f7f8n h7h8 e8h5 b7b5 h5g6 b5e5 f8d7 e5e6 f6f7 e6e1 g6b1 e1f1 f7f8q f1f8 d7f8 h8g7 f8e6 g7f7 e6c7 f7e7 c7b5 e7d7 b5a3 d7c6 b1d3 c6d7 a3c2 d7c6 a2a4 c6d7 a4a5 d7c6 a5a6 c6b6 a1a2 b6c7 a2b3 c7b6 b3b4 b6c7 b4c5 c7d8 a6a7 d8c7 a7a8q c7d7 c2e3 d7e7 e3d5 e7f7 a8h8 f7e6 h8e8
info depth 47 seldepth 49 multipv 1 score mate 28 nodes 250590540 nps 9993640 hashfull 107 tbhits 4909071 time 25075 pv f8g7 f6g7 f5f6 g7h7 f7f8n h7h6 e8h5 b7b6 h5g6 b6e6 f8e6 h6g6 e6d4 g6f6 d4c2 f6e5 c2a3 e5d4 a1b2 d4d5 b2b3 d5c5 a3c4 c5b5 a2a3 b5c6 b3b4 c6d7 a3a4 d7c6 a4a5 c6d7 b4b5 d7c7 a5a6 c7b8 c4d6 b8a7 d6e8 a7b8 b5b6 b8c8 a6a7 c8d8 a7a8q d8e7 a8g2 e7e6 g2g5 e6f7 b6c6 f7f8 c6d7 f8f7 g5g7
info depth 49 seldepth 39 multipv 1 score mate 27 nodes 320510315 nps 10294212 hashfull 136 tbhits 6356974 time 31135 pv f8g7 f6g7 f5f6 g7h7 f7f8n h7g8 e8h5 b7c7 a1b1 c7b7 b1c1 b7c7 c1d2 g8f8 e6e7 c7e7 f6e7 f8e7 h5e2 e7d6 d2c2 d6c5 c2b3 c5d6 b3a3 d6c5 e2f1 c5d6 a3b4 d6e7 a2a4 e7d6 a4a5 d6d5 f1g2 d5e6 a5a6 e6f7 a6a7 f7e6 a7a8q e6f7 g2e4 f7e6 a8f8 e6d7 e4d5 d7c7 f8e7 c7c8 d5h1 c8b8 e7b7
info depth 57 seldepth 41 multipv 1 score mate 25 nodes 446764167 nps 9719448 hashfull 186 tbhits 9183029 time 45966 pv f8g7 f6g7 f5f6 g7h7 f7f8n h7g8 e8h5 b7c7 a1b1 g8f8 e6e7 c7e7 f6e7 f8e7 h5e2 e7d6 b1c2 d6c5 c2b3 c5d6 b3a3 d6c5 e2f1 c5d6 a3b4 d6e7 a2a4 e7d6 a4a5 d6d5 f1g2 d5e6 a5a6 e6f7 a6a7 f7e6 a7a8q e6f7 g2e4 f7e6 a8f8 e6d7 e4d5 d7c7 f8e7 c7c8 d5h1 c8b8 e7b7
Still mate 25 at depth 77.
I'm curious, what engine was this with? Seems quick!! :) Will check Stockfish, Fritz 14 (uses Nalimov) and a few others to see
how they compare.

Andrew
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: DTM50

Post by hgm »

Andrew wrote: Fri May 03, 2019 9:59 am I'm interested in getting lower mates scores for puzzles etc, not during game play.
Sure, but puzzles in general start with the ply counter at zero. They do not require the full set of DTM50 EGT for other counter values.

If the puzzle position is not actually in the EGT itself, so that the EGT is only used in probing, you would never enter the EGT with non-zero ply counter, even if the original puzzle position had one.
Dann Corbit
Posts: 12538
Joined: Wed Mar 08, 2006 8:57 pm
Location: Redmond, WA USA

Re: DTM50

Post by Dann Corbit »

I imagine that this is really ignorant, but I do not understand why a DTM50 counter is needed in the database.

If you are trying to minimize the distance to mate, then your path will be shortest.
And if you (the engine writer) are storing the move counter, the engine will know if there is a problem where the dtm50 flag is going to fall.
The database cannot find a shorter mate than the shortest one that is in there.
And if the engine writer knows that the flag is going to fall, he can abandon the planned search and consider moves that reset the counter. And if these moves cannot find a win, then there was no win to be found anyway.

So I guess that I think the EGTB's job is to find the fastest path to win, assuming the counter is reset to 0.

I suppose the current counter could be sent to the EGTB and the EGTB itself could perform the search instead of the engine. But I do not see that as an improvement. (Though an efficient, debugged implementation would prevent all the engine writers from having to do it.)

I do admit that a DTM50 tablebase that was not substantially larger than a simple DTM tablebase that assumes a reset counter would be very interesting. But I imagine it would be many times larger than a simple DTM tablebase.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.