More adventures with endgame tablebases

22 Oct. 2018 | by Peter Wong

Endgame tablebases are software that provides perfect play information with total accuracy for any position with up to seven pieces. They can determine (1) the outcome – win, loss, or draw – of every legal move in such positions based on optimal play by both sides, and (2) the precise number of moves required to force a mate for each winning or losing move. I gave a brief overview of tablebases in the previous Walkabout (8 Sep. 2018) and considered how they have been utilised in the field of chess composition. Here I will present three remarkable positions that came about with the aid of this tool. The first two are examples of mutual zugzwang, a paradoxical situation where neither player wants to be the side to move. The third is an offbeat endgame study that cleverly exploits not only tablebase data but also a problem convention relating to the 50-move draw rule.

In a mutual zugzwang (MZ) position, whoever has the move would prefer to pass on the turn because every possible move of each side contains a significant weakness, one that would result in a worse outcome than if the other player is to move. This curious type of situation is considered interesting in endgame theory, and tablebases have been used to systematically uncover examples. Recently the composer Árpád Rusz (mentioned in the last column) devised a program to generate hundreds of thousands of 7-piece MZ positions, categorised according to materials such as KPPP vs KPP and KRPP vs KRP. He has kindly shared on his site these massive lists of positions, from which I select two unusual cases. Both are attractively open settings with fairly mobile pieces and passed pawns, so the double-zugzwang is especially surprising. They also illustrate the less common full-point MZ. Whereas in a typical MZ one of the players would win if it’s the other’s turn but still draw if given the move, in a full-point MZ whoever is to move would lose the game.

MZ is a popular theme in endgame compositions, but of course not all MZ positions are suitable for adapting into studies. The diagram below shows a borderline case where White’s play at some stages is too imprecise to work as a proper study, but redeeming features include a delightful key-move and a natural try that make the MZ theme hard to miss, plus a fitting finish. [Syzygy TB Link – discussed below]

Mutual zugzwang study (?)

White to play and win

White’s only winning move is 1.h3!!, producing the MZ position. Now not only is Black in zugzwang, but if it’s White’s turn again [Syzygy TB Link], then 2.h4 (or any other move) would lose, and that implies 1.h4? would fail too and hence function as a thematic try. The double-step is refuted by 1…Kd5! 2.Kc3 (2.h5 Ke6 3.h6 Kf6 4.h7 Kg7 5.Kc3 Kxh7 6.Kb4 Kg6 7.Kxa4 Kg5 8.Kb4 Kg4 9.Kc3 Kf3 10.Kd2 Kf2 and White must lose the pawn) 2…Ke6 3.Kb4 Kf5 4.Kxa4 Kg4 5.Kb4 Kxh4 6.Kc4 Kg3 7.Kd5 Kf3 8.Kxe5 Kxe3 and Black wins.

The advantage of 1.h3!! is that by attacking g4, it will cost the black king an extra tempo to capture the h-pawn. 1…Kd5 (1…a3 2.h4 a2 3.Kb2 Kd3 4.h5 Kxe3 5.h6 Kd2 6.h7 e3 7.h8=Q wins) 2.Kc3 (2.Kb2 and then 3.Ka3 also works) 2…Ke6 3.Kb4 Kf5 4.Kxa4 Kg5 5.Kb4 (the white king can approach in other ways as well) 5…Kh4 6.Kc4 Kg3!? Sets a trap for White: 7.Kd5? Kf3! 8.h4 (8.Kxe5? loses to 8…Kxe3 because Black’s e-pawn will promote with check) 8…Kxe3 9.h5 Kd3 10.h6 e3 11.h7 e2 12.h8=Q e1=Q draws. 7.h4! Kxh4 (7…Kf3 8.h5 wins) 8.Kd5 Kg3 9.Kxe5! (9.Kxe4? Kf2 draws) 9…Kf3 10.Kd4! We end with a well-known full-point MZ position – whichever side is to move will lose their pawn and the game.

Despite both players having a rook in the next position, neither side (if given the turn) has a waiting move that could avoid fatal self-damage. The rooks are mostly tied to their ranks as they are stopping their opponents’ pawns from promoting. White’s connected passed pawns seem very strong, but to balance that, Black has opportunities for effecting a back-rank mate.

Mutual zugzwang position

White to play: Black wins

White to play: Black forces a win. [Syzygy TB Link] White’s most interesting defence is 1.Ke1. The more tempting 1.g7, by closing the long diagonal, loses to 1…Rb1! because 2.h8=Q no longer deals with the threat of 2…Rxc1+ 3.Kxc1 a1=Q mate (or 2.Ke1 Rxc1+ though 2…Ke3 is an even faster win for Black). Any first move by the white rook is defeated easily, e.g. 1.Ra1 Rb1+ 2.Rxb1 axb1=Q mate. The weakness of 1.Ke1 is that the white king no longer protects the rook, inviting 1…Rb1! Now White has two alternatives with subtle differences, even though they soon transpose into each other. (1) 2.h8=Q Rxc1+! Not 2…a1=Q? 3.Qxa1! Rxa1 4.Rxa1 wins. 3.Kf2 a1=Q and Black has a Q+R vs Q book win, which the g-pawn is not sufficiently advanced to thwart. (2) 2.Kf2 Rxc1! Not 2…a1=Q? 3.Rxb1! Qxb1 (if the black queen checks, White still draws, e.g. 3…Qf6+ 4.Ke1! Qxg6 – threatens mate and the h7-pawn – 5.Rb3+!) 4.h8=Q draws. 3.h8=Q a1=Q transposing to the same Q+R vs Q win as (1).

Mutual zugzwang position

Black to play: White wins

Black to play: White forces a win. [Syzygy TB Link] Black has no standout move that compels White to play precisely for long, but 1…Rf8 could be viewed as the thematic line… If Black tries 1…Rb1 – such an effective response when White moves first – then White wins with 2.h8=Q a1=Q (2…Rxc1+ 3.Kxc1) 3.Qxa1 (3.Qh3+ also wins) Rxa1 4.Rxa1. The second alternative 1…Rc8 is a nice sacrifice that cannot be accepted (2.Rxc8? a1=Q+ 3.Rc1 and Black mates in three with 3…Qb2/Qd4): 2.Ra1! Rb8 (threatening 3…Rb1+) and 3.Kc1 wins as the back-rank threats have dissipated and the connected pawns become decisive. After 1…Rf8, the mating threat on f1 forces 2.Ke1 and now 2…Re8+ is answered by 3.Kf2/Kf1, again winning for White because the king is out of danger. Here White must avoid 3.Kd1? when Black wins with the unique 3…Rb8!!, which brings back the diagram position with White to play and in zugzwang!

These MZ positions are extracted from the recently completed 7-piece Syzygy endgame tablebases, a free alternative to the Lomonosov tablebases. Their main difference is the metrics used to determine when a position is “won.” The more standard depth-to-mate (DTM) metric calculates the number of moves needed to achieve mate, disregarding the 50-move draw rule. Syzygy examines depth-to-zeroing (DTZ) instead: how quickly we can reach a “zeroing” move – a capture, a pawn move, or mate – that would reset the count for the 50-move rule (while maintaining the win). Now, since the 50-move draw rule doesn’t actually apply to chess compositions (see below), the DTZ metric holds no special advantage when used to analyse composed problems and studies. Indeed, for verifying directmate problems, where the quickest route to mate is stipulated, only DTM is suitable. For checking studies, which require a win or a draw to be found without imposing a move limit, the specific DTM or DTZ numbers are not that relevant, but both tablebase types are useful in revealing the win/loss/draw outcome of each possible move.

Oddly enough, our very next example contradicts what I just said about the unimportance of DTM and DTZ figures in studies! To grasp this unusual piece of work, first we have to consider how the 50-move draw rule is treated in compositions. On the World Federation for Chess Composition site, the Codex for Chess Composition states in Article 17: “Unless expressly stipulated, the 50 moves-rule does not apply to the solution of chess compositions except for retro-problems.” It makes sense for problems and studies – with their aesthetic intent and idealised play – to ignore such a rule, one based on an arbitrary number. The exception is made for retros to cover a sub-genre of problems in which it can be proved by retro-analysis that a large number of moves have taken place without a capture or a pawn move, such that the 50-move rule comes into play and it becomes part of the problem’s theme. Such retro problems involve intricate retractions and heavy positions, and seem far removed from the miniature studies we’ve been looking at, the sort where tablebase analysis is practicable. Yet by making allowance for these traditional retros, Article 17 has an unexpected consequence in certain situations, one brought to light by the composer of the following study.

Andrew Buchanan
Problem Database website 2017


By convention, the “Draw” stipulation means White is to play and force a draw, but how can that be the goal here when White has multiple mate-in-one moves? It turns out, upon further inspection, that Black couldn’t have made the last move to reach the diagram position. That’s because if the black king had just moved from a7 or b7 to b8, the piece would have been in an impossible double-check by the white pieces; and if the black queen had just come from any of the empty squares, a7, b7, c6, or d5, the piece would have been checking White while it’s Black’s turn – again an impossibility. That means, for the position to have arisen legally, White must have made the last move and it’s Black to play now. Black’s best move is 1…Qxa6 (anything else would allow White to at least draw easily). Now we have a KQ vs KBB ending, which is generally a win for the queen side. Indeed, if you were to set up this position on the Lomonosov tablebases (or the Nalimov ones), you’d find that the DTM is 69, i.e. Black has a forced mate in 69 moves against White’s best defence. So how can White achieve a draw?

Well, the study has required us to use retro-analysis to determine that it’s Black to play in the diagram. Therefore it also counts as a retro problem, and according to Article 17, the 50-move rule comes into effect! The DTM69 here is over 50 but it doesn’t actually tell us if Black could force a win under the 50-move rule, as that condition calls for a different winning strategy. This is the zeroing strategy mentioned above, where a player aims for a capture or a pawn move and thus reset the move count. We can see the exact results of this approach, viz. the DTZ numbers, by consulting the Syzygy tablebases. Here’s a link to the Syzygy site with the position already set up. Note that Syzygy also provides DTM data for positions with five pieces or fewer, but a little confusingly, they use single-move numbers (for both metrics), unlike Lomonosov and Nalimov which use the more familiar pair-move format; that’s why Syzygy indicates DTM137 for this position rather than DTM69. Now for the DTZ results, only one white move has a number higher than 100: Bc7+ with DTZ117. Thus after this bishop move, Black will need more than 50 moves to force a winning capture, but before the latter could be made, White can claim a draw under the 50-move rule as per Article 17. Therefore 2.Bc7+! is the unique drawing move. What a witty and imaginative composition! For more examples of this idea, check out its author’s Endgames to make your head hurt.