My Great Idea

Martin Bennedik’s automated puzzle machine

08 May 2020

In 2016 Martin Bennedik hesitated to put his latest project online. “The algorithm was not yet perfect.“ Friends persuaded him to make chesspuzzle.net public nevertheless, but Bennedik put a “beta” symbol on top of his page – “in development”. Four years later, the “beta” is still there, and Martin Bennedik still thinks it’s not perfect. It is good enough for Magnus Carlsen however.

“Back in 2016 friends persuaded me to make chesspuzzle.net public. I knew that the algorithm was not yet perfect so I put a beta symbol on top of the page. Beta means ‘in development’ and the beta is still there. I still don’t think chesspuzzle.net is perfect and I am not sure it ever will be.

Martin Bennedik
Martin Bennedik

My algorithm is searching games for positions that make good puzzles. I desire positions where a combination or otherwise stunning move is possible and that move is clearly the best in that position. Games from youth tournaments with strong, but not super strong players contain the highest number of potential puzzles. The harvest in world class tournaments is much lower.

Chesspuzzle is not my first chess project. In 2008 I developed a Silverlight app that enables live broadcasts of chess games. This sounds trivial today but back then it was new. Mark Crowther integrated it into his The Week In Chess page and fed it with the moves Kramnik and Anand made in Bonn, thus enabling his site’s visitors to watch the games live while browsing TWIC.

Ideas like this usually come up when I am on training courses. In this way I bring together my hobby and my profession.

For years I had too little time for club chess and played correspondence chess. But when you are only playing correspondence chess your calculation skill suffers because the engine does all the tactics for you. When I joined my club SV Frankfurt-Nord I needed to get back into shape and tried several tactics trainers on the Internet.

I was sure I could do this better

It was quite disappointing. With some puzzles, the system says you have solved the task, but the position is not yet clear. With others, you make a move that wins, but the system rejects your solution because another move wins more clearly.

If there is a second, sub-optimal winning move, the program should say ‘There is a better move’ and allow the player to try again. I was sure that I could do this better. Two friends, Oliver Koeller and Felix Kleinschmidt, helped me to overcome several problems like the secondary solutions.

Four years later, the "beta" is still there.
Four years later, the "beta" is still there.

My algorithm looks for positions where one side plays the only winning move while all other moves lose or keep the position in balance. That is the main criterion for a puzzle – a forced move or forced move sequence the human solver will have to find. Once such an only move is found, the algorithm tries to build a puzzle around it. It creates a solution tree. But if the tree is growing too large because the losing side can delay the loss for many moves for example, the machine will stop at some point and reject the position. The same goes for a winning move that is too easy like a simple capture.

A perfect algorithm would have a sense for aesthetics

I added a classification by level of difficulty. Last year I implemented a classification by motif: forks, double attacks, deflections, skewers and so on. Users of chesspuzzle.net can now filter for tactical motifs or go through different levels of a category of puzzles. That is especially helpful for beginners. I use this option with the children of my club. Recently I worked on endgame tactics.

The brains behind Tactics Frenzy: Martin Bennedik in good company.
The brains behind Tactics Frenzy: Martin Bennedik in good company.

One challenge is for the algorithm to decide if a position is really winning. A computer evaluation of +2 doesn’t necessarily mean it’s a win. The weaker side might have a fortress. Some puzzles are still not conclusive to humans, and I am still refining my algorithm.

Jon Ludvig Hammer saw chesspuzzle.net and introduced me to Play Magnus. Thus I became involved in the development of ‘Tactics Frenzy’. My algorithm is now also finding new puzzles for this app, sorting them by motif and rejecting dubious candidates. The co-operation helped me to improve my algorithm, and they have provided three strong servers for the search.

Chesspuzzle.net is creating 250 to 300 puzzles daily. Each day I pick a particularly attractive puzzle manually as ‘puzzle of the day’, and many websites have incorporated this feature. A perfect algorithm would do it by itself. It would be able to sort puzzles by beauty, it would have a sense for aesthetics.”

(as told to Conrad Schormann)

Martin Bennedik is a freelance .NET developer since 2003, club player, International Master in correspondence chess, founder of Chesspuzzle.net and collaborator of Play Magnus on the Tactics Frenzy app. He lives in Frankfurt am Main, Germany. In the chess world he is also known for his twitter account that provides detailed stats whenever a candidates race is on.