Stockfish and a modern classic more-mover

12 Mar. 2018 | by Peter Wong

The rise of chess engines in the last decade or so is an interesting topic from which I’ve been somewhat insulated, because of my focus on problem chess. Frequenting the Chess.com site has helped me to catch up with the advances of these incredible programs, which perform at superhuman levels on modest hardware. Thus I learnt that Stockfish, one of the strongest engines with an Elo rating of around 3500, is open source software that is accessible for free. And you don’t even have to install it on your computer; you can play against Stockfish directly on Chess.com, or set up a position on the site for the engine to analyse.

As a problemist, I was naturally curious to see how efficiently Stockfish deals with long directmate problems. And the answer seems to be “very.” It solved the great majority of more-movers of up to about 12 moves that I tested in mere seconds, and even cooked a few. (Note that when you run Stockfish on Chess.com, its speed still depends on your own computer’s processing power.) Although this is impressive, Stockfish is of course no substitute for a specialised problem solver like Popeye, which uncovers all of the variations in a problem and provides certainty to its soundness. Stockfish is designed to keep looking for the best move indefinitely, or it stops analysing according to a time-limit, so you can’t tell if any forced mating sequence it has found is in fact the shortest possible. Furthermore, Stockfish can be inconsistent in being unable to crack some not-very-long directmates in a reasonable time. Here is an excellent 9-move problem that stumped the engine, but was solved by Popeye in less than eight minutes.

[Note: This blog was written in 2018 and used the then current Stockfish version 8.]

Theodor Siers
Die Schwalbe 1935

Mate in 9

White’s plan is to mate on e7 with the bishop, while avoiding stalemate from capturing the knight. Black is almost in zugzwang, since most knight moves allow the bishop mate and 1…Sd5/Sc6 is answered by the waiting move 2.Bc5, after which the knight must unguard the mating square. However, White has to move the king first to fend off 1…Sc2+. 1.Kb2? fails to 1…Sxd3!+ 2.K-any Sc5 3.Bb4 Sxe4!, creating an escape square on f5 for the black king. White therefore plays 1.Kb1!, but after 1…Sd5, 2.Bc5? is premature because of 2…Sc3+!, again winning the vital e4-pawn. If 2.Kc2? instead, Black counters with the resourceful 2…Se3+! 3.K-any Sf5!, which simultaneously protects e7 and attacks g7, thus dislodging the white rook. So where should the white king go? No progress is made if it stays on the queen-side, because the black knight can continue to switch between b4 to block the bishop and d5/c6, where the knight either checks directly or (if White plays Bc5) executes a fork that will give the piece access to e4 or f5, as previously seen. Correct is 2.Kc1! forcing 2…Sb4, and then 3.Kd1! Sd5.

At this point, you might guess that the theme of the problem is that the white king marches all the way from a1 to h1 without leaving the first rank. Hence not 4.Bc5? or 4.Ke2? because of 4…Sc3+ again, but 4.Ke1! Sb4 5.Kf1! Sd5 6.Kg1! Sb4 7.Kh1! Sd5, and finally the king is safe from checks by the pesky knight – 8.Bc5 S-any 9.Bxe7. The solution exploits a curious geometric feature: h1 is the only white square on the board that cannot be attacked in one move by a knight on either d5 or c6. The maximum-length orthogonal trip by the white king is superbly engineered in this first-rate composition.

When Stockfish tackled this position, it took a few minutes to find a forced mate in 13, starting with 1.Rxh7. After a couple of hours, it picked the right first move, 1.Kb1!, but based that on a wrong continuation, 1…Sd5 2.exd5?, which lets the black king escape to f5, and this leads to mate only on move 12. Are there directmates even shorter than this 9-mover that cannot be solved – within an hour, say – by Stockfish? With few clues on what would give the engine trouble, I threw some random 7- and 8-move problems at it, but most were handled quickly. Then it occurred to me that I could try using the current problem by Siers but with the first few moves of its solution shaved off; at which point of the shortened variation will Stockfish get it right? As it turns out, the engine found the solution only at the mate-in-5 stage. That means the shortest forced-mate sequence I know of that cannot be solved by Stockfish is a mate-in-6, with the white king starting on d1 and the black knight on d5. Can anyone unearth a mate-in-5 position that is too difficult for Stockfish!?