How to determine DTZ?

Endgame analysis using tablebases, EGTB generation, exchange, sharing, discussions, etc..
Post Reply
Dhanish
Posts: 47
Joined: Fri Sep 14, 2007 5:25 am
Sign-up code: 0
Contact:

How to determine DTZ?

Post by Dhanish »

How can one determine DTZ from the DTM (Nalimov) tablebases?

In the position No 7: 8/8/8/8/3B4/1q6/3KN3/k7 b posted earlier, Guy Hawk gives DTC/DTM/DTZ as

042/053/042.

According to Wilhelm, there is a capture on move 35. How is this discrepancy?

PGN Output from Wilhelm:

[Event "EGTB"]
[Site "-"]
[Date "2008.03.03"]
[Round "1"]
[White "?"]
[Black "?"]
[Result "0-1"]
[SetUp "1"]
[FEN "8/8/8/8/3B4/1q6/3KN3/1k6 w - - 1 1"]
[Annotator "Wilhelm 1.50"]

{Black wins: win in -52}
{on the move lengthens win by 16}
1. Ne2-c3+ $1 (Ne2-c3+ {#-52}) (Ne2-f4 {#-41}) (Bd4-f2 {#-38}) (Bd4-e5 {#-37}) (Bd4-g1

{#-37}) (Ne2-g1 {#-36}) (Bd4-c3 {#-36}) (Bd4-g7 {#-36}) (Bd4-e3 {#-34}) (Bd4-f6 {#-24})

(Bd4-h8 {#-23})
(Bd4-c5 {#-21}) (Bd4-b6 {#-21}) (Bd4-a7 {#-21}) (Kd2-e1 {#-20}) (Bd4-a1 {#-18})

(Ne2-c1 {#-16}) (Ne2-g3 {#-14}) (Bd4-b2 {#-12})
Kb1-b2 $1 2. Nc3-b5+ $1 Kb2-a2 $1 3. Nb5-c3+ $1 Ka2-a3 $1 4. Bd4-c5+ $1 Ka3-b2 $3 5. Nc3-d1+

$1 Kb2-b1 6. Nd1-c3+ $1
Kb1-a1 $1 7. Bc5-d6 $1 Qb3-b2+ $1 8. Kd2-d3 $1 Qb2-c1 9. Nc3-d5 Qc1-b1+ 10. Kd3-c3 Qb1-d1 $1

11. Kc3-c4 $1
Qd1-a4+ $1 12. Kc4-c5 $1 Ka1-b2 $1 13. Nd5-f6 $1 Qa4-d1 14. Nf6-d5 $1 Kb2-b3 $1 15. Nd5-f6

Kb3-c2 16. Bd6-e5 $1
Kc2-d3 $1 17. Kc5-d6 $1 Qd1-b3 $1 18. Kd6-e7 $1 Qb3-a2 19. Be5-g3 Kd3-c4 20. Bg3-f4 Kc4-c5

$1 21. Bf4-d2
Qa2-b3 22. Bd2-f4 $1 Qb3-f3 23. Bf4-e5 $1 Qf3-f5 $1 24. Be5-h2 Kc5-b5 25. Bh2-g3 Kb5-c6 $1

26. Ke7-f7 $1
Qf5-b5 $1 27. Bg3-h2 $1 Qb5-c4+ $1 28. Kf7-g7 $1 Qc4-h4 $1 29. Bh2-b8 $1 Qh4-b4 $1 30.

Bb8-g3 $1 Qb4-d2 $1 31. Kg7-f7 $1
Qd2-e3 $1 32. Bg3-h2 $1 Qe3-c3 $1 33. Kf7-g7 $1 Qc3-d2 $1 34. Bh2-b8 $1 Kc6-b7 $1 35. Kg7-f7

$1 Kb7xb8 $1 36. Kf7-e6 $1
Kb8-b7 37. Nf6-e4 Qd2-d4 38. Ne4-d6+ Kb7-b6 39. Nd6-f5 $1 Qd4-e4+ $1 40. Ke6-f6 $1 Kb6-c6

41. Nf5-e7+ $1
Kc6-d7 $1 42. Ne7-f5 Qe4-f4 $1 43. Kf6-g6 $1 Kd7-c6 44. Nf5-h6 Kc6-d6 $1 45. Nh6-f5+ Kd6-e5

$1 46. Nf5-g7 $1
Qf4-f6+ $1 47. Kg6-h7 $1 Qf6-g5 $1 48. Ng7-e8 $1 Qg5-h5+ 49. Kh7-g7 Qh5xe8 $1 50. Kg7-h6 $1

Qe8-g8 51. Kh6-h5 $8
Ke5-f5 $1 52. Kh5-h4 Qg8-g4# $1 0-1
Codeman
Posts: 85
Joined: Fri Oct 19, 2007 7:50 pm

Re: How to determine DTZ?

Post by Codeman »

DTM tries to minimize the number of moves to mate
DTZ tries to minimize the number of moves to the next zeroing move (in pawnless endgames: captures)

It can be that there will be a capture in 35 moves in DTM, which in continuation leads to the quickest mate. But it is in this case possible for the loosing side to delay any captures that lead to lost subendgames. Lost Subendgames that will in total be quicker won then when playing after the DTM metric.

What I am saying is that there is no simple way of converting from one value to another. You can only say that DTM >= DTC >= DTZ
and for pawnless endgames DTC = DTZ
guyhaw
Posts: 489
Joined: Sat Jan 21, 2006 10:43 am
Sign-up code: 10159
Location: Reading, UK
Contact:

Re: How to determine DTZ?

Post by guyhaw »

This from a close relative of Guy Hawk ... :)

'Depth to Mate' (DTM) is the number of [usually] winner's moves to Mate, given that the winner is minimising DTM, the loser is maximising DTM, and both correctly assume the strategy the other side is using.

'Depth to (Move-Count) Zeroing (Move)' (DTZ) is the number of winner's moves to the next zeroing of the move-count, given that the winner is minimising DTZ, the loser is maximising DTZ and both correctly assume the strategy the other side is using. DTZ =< DTM: there is nothing you can tell from a DTM EGT about DTZ other than that the DTM puts a top limit in DTZ.

http://chess.jaet.org/cgi-bin/dtx is a multi-metric site where you can see 'DTM lines' and 'DTZ lines' diverging.

In the DTM-line, you have a capture on move 35, but this may be before, after or at the same time as a capture happens in the DTZ line.

guyhaw(orth)
Dhanish
Posts: 47
Joined: Fri Sep 14, 2007 5:25 am
Sign-up code: 0
Contact:

Re: How to determine DTZ?

Post by Dhanish »

Thankyou for the explanation, Codeman, and Guyhaw (Sorry for the "k" earlier!).

It seems I misunderstood the definition of DTZ.

In actual play, the winning side needs to minimise DTM, subject to the constraint that DTZ<50. Am I right? Are there any such tablebases?

In correspondence chess, there have been instances where the game was drawn by 50 move rule, but a mate is available in a few moves more.

Ideally, an engine should evaluate a position with DTZ>50 as drawn though a mate is available. Is there any engine which takes this into account?
Codeman
Posts: 85
Joined: Fri Oct 19, 2007 7:50 pm

Re: How to determine DTZ?

Post by Codeman »

Currently the DTM-metric is the most common format (eg Nalimov tablebases) and it doesn't support the 50 moves rule. It shows a win, if you convert to a won subendgame that takes more than 50-moves to complete. I don't know of any DTM metric-variation that considers the 50 moves rule. This feature is more common for the DTZ metric. This makes more sense as any zeroing move will interupt the counter for the 50 moves.
I think some of the 6men egtb have been generated in the DTZ-50, but it is not very common and the files are not very well shared. So I don't know of any engines that use this format. More common are still DTM, normal DTZ (especially for 7 pieces) and Bitbases.
guyhaw
Posts: 489
Joined: Sat Jan 21, 2006 10:43 am
Sign-up code: 10159
Location: Reading, UK
Contact:

Re: How to determine DTZ?

Post by guyhaw »

John Tamplin computed DTZ50 EGTs for the 6-man P-less endgames using Marc B's generalisation of Eugene N's code. These EGTs are not yet available 'on general release' but no doubt could be if Google engage with the heritage, perfect knowledge and information-potential that these and other EGTs represent.

Certainly, one might say that scoring a win with DTZ > 50 as a draw is a step forward. However, this assumes that one is facing an infallible opponent who maximises DTZ. Preferable is to have the 'DTR' EGTs which indicate the smallest 'k' for which one might win under a k-move rule. That way, one can minimise how much the (hopefully) fallible opponent has to concede.
g
h.g.muller
Posts: 223
Joined: Mon Feb 19, 2007 8:24 am
Sign-up code: 0
Location: Amsterdam
Contact:

Re: How to determine DTZ?

Post by h.g.muller »

Note that this statement assumes that the opponent is equally fallible in all subsequent phases. I.e. if the DTR value of a certain end-game that needs two conversion / zeroings to be won against best play is 60, this is likely to be the result of an attempt to spread the pain evenly over the intermediate phases. I.e. 60 moves to the first conversion, then 60 moves to the second conversion, then 60 moves to the mate. Otherwise (i.e. if the DTR was dominated by a single phase) it would likely be possible to shorten that phase by spending some extra time in an earlier phase (manouevring to get a more favorable conversion).

In practice, however, an opponent is more likely to be fallible in the more complex (i.e. earlier) phases. Especially if the opponent is a computer. Then he either has the EGTB for the phase, or not. And he is more likely to be lacking a 6-men than a 5-men. So I will program my computer to always go for the conversion that exceeds 50 moves least in the last phase that has to exceed 50 moves. Even if that would drive up the number of moves I need above 50 more in an earlier phase. Better to aim for 75 moves in the 6-men followed by 49 in the 5-men, than 55 vs 51. Because he will almost certainly have the 5-men EGTB. So aiming for 55+51 will run into a certain draw in the 5-men phase, making it irrelevant how much better our chances are in the 6-men phase.
guyhaw
Posts: 489
Joined: Sat Jan 21, 2006 10:43 am
Sign-up code: 10159
Location: Reading, UK
Contact:

Interesting point about multiple phases ...

Post by guyhaw »

hgm is correct that the more men on the board, the more fallible an opponent is likely to be. There is however an approach (at least in theory) to using 'spare moves' in a phase if one has the DTR and DTZR EGTs. Let us suppose DTZR is << the number of moves available.
One might therefore choose a move that maintains DTR but increases DTZR, provided this did not risk a 50-move draw-claim in the phase or a 3x-repetition of position. Ensuring that the latter does not happen is achieved by my 'Scorched Earth Algorithm' which sets positions visited twice [artificially] to 'draw' and adjusts dependant positions' values to achieve consistency in the EGT. The idea is to max the opponent's opportunity to concede in DTR terms (as this derisks the highest-risk phases).
Given a model of the fallible opponent (which can be derived by Bayesian inference which I've written about), and the Scorched Earth Algorithm, it is worth evaluating the 'Expected DTR' which will be achieved by going down different branches of the tree of feasible moves. One might even risk 'DTR', voluntarily conceding in DTR terms in the expectation of a gain which will more than compensate for the concession.
h.g.muller
Posts: 223
Joined: Mon Feb 19, 2007 8:24 am
Sign-up code: 0
Location: Amsterdam
Contact:

Re: How to determine DTZ?

Post by h.g.muller »

OK, that makes sense. If any subsequent phase would not be won against perfect play (be it due to 50-move rule or otherwise), spend maximum time in the most complicated phase to give the opponent opportunity to blunder. With the underlying assumption that he is more likely to blunder in the complicated phase than after simplification.

One might doubt this assumption, of course. If the conversion is reducing the material of the defender, the defense might actually be easier in the current phase. But as long as it is a free shot, there is no harm in trying.

Opponent modeling is a very difficult subject.
guyhaw
Posts: 489
Joined: Sat Jan 21, 2006 10:43 am
Sign-up code: 10159
Location: Reading, UK
Contact:

Minimising DTR

Post by guyhaw »

The Strategy (i.e. the move-subsetting algorithm) I am working on minimises 'Expected DTR' within the constraints of (if possible) not risking a k-move draw-claim (where 'k' can be set to 50 for chess) in the current phase or repeating a position T times (where T can be set to 3 for chess).

It does not aim to spend the most time in the most complex phase of the game. It aims to spend as much time as possible in the current phase.

The more fallible the opponent, the more likely it is that actually 'hazarding' DTR, i.e. risking it increasing with an optimal defence, is better than hard-constraining the strategy to defend the current DTR. Jansen first proposed that one should play the opponent as well as the game, and demonstrated this in KQKR with the somewhat extreme assumption that the opponent chose moves at random with zero skill.

Jansen did not propose a model of a Fallible Player, so I did - in the ICGA_Journal paper 'Reference Fallible Endgame Players'. The basic idea is to have an endgame-playing engine with perfect (EGT) knowledge and equip it with a 'competence parameter' c. The engine is topped by a roulette wheel with a sector for each possible move, and 'c' determines the width of each sector based on the depth of the position resulting from playing that move. A random number then determines what move is actually chosen: c = 0 implies all moves are equally likely, c = +infinity implies that only metric-optimal (e.g. DTC-optimal) moves are chosen.

I have recently generalised the idea to the whole game of chess in a paper 'Gentlemen: Stop Your Engines!', also in the ICGA_J. Apparently, the ICGA_J editor was somewhat discouraged by the less-than-sober title in a way he would not have been if I had called it 'Reference Fallible Players'. I still smile when I think of that.

g
Post Reply