title: Tactics chess
description: a chess puzzle generator and solver interface
---
Tactics training is such an essential part of chess if you want to improve. So much so that I bought a premium chess.com subscription mainly for the unlimited tactics they give. But then I thought, why not do my own and have unlimited tactics to practice on? See that cluster from laptops a couple of posts ago? well that is the chess engine cluster that I’m using to generate tactics training puzzles such as this:
white to play and get a good position with blacks king wondering around the board

So how are tactics like these generated? Find the positions for tactical opportunities is actually rather simple. You get some game PGN’s, and feed them into a chess engine like stockfish, and mark the position where the engine evaluation goes from a draw-ish position to a material advantage for one side. For example consider the board state
Code: Select all
`r1b1r3/1p1nqpkp/p3pnp1/3p2N1/3P3Q/2NBP3/PP3PPP/3R1RK1 b - - 13 15`
The chess engine evaluation line actually gives you the lines that it considers good, so that’s a big help. You just need to have the player play along these lines, but for how many moves? A tactical position may result in an advantage in 2 moves or 5 moves after a long combination. What I have found that works nicely are the following conditions for termination:
* Go a maximum of 6 moves (12 plies) deep during searching. 6 moves deep is very challenging even for masters of the game.
* if the last move was not a capture
* if the last move was not a check
* if the last move was not a mate in X move
* if the opponent would pass, a capture would not be made
Checking for these conditions after every candidate move leads to some pretty decent puzzles.
Here is my poor-mans cluster that crunched all the games to generate the tactics