Saturday, May 16, 2015

Chess is 99% tactics

Tactics for School Chess Volume 6 (Problem #8 - Mate in 2)
I'm currently in the process of building a database of not to hard chess tactics for my kids to get some practice. After searching the net for a while I followed the recommendation to use the collection of Paul Gaffron of about 3000 problems especially designed for younger kids to improved their tactical vision.

They are only available as hardcover so I ordered them in a local chess store. In total they consist of 12 volumes of increasing difficulty with about 250 problems each. I decided to start with volume 4 as this seems to fit the current strength of my boys best.

In my new GUI there is a tactics training module that reads in a set of problems in PGN format, presents them on the board, checks the user input for correctness, sums up and saves the scores and even has the option to repeat the problems one initially failed. To use it all I had to do was transferring the problems from the books into PGN format.

I came up with the following approach.
  1. Setup the position from the book in my chess GUI (takes about 30s in average per position)
  2. Copy the FEN of that position in a FEN collection file 
  3. If all FENs are collected run a chess engine over the positions and use their best move (or move sequence) suggestion as solution
  4. Store each problem with its solution in a PGN file

3r4/p4rPk/1b1q1P2/2p1p3/8/5NR1/5P1P/6RK w - - 0 1

[Event "Tactics for School Chess Volume VI"]
[Site "Mate in 2"]
[Date "2015.05.04"]
[Round "8"]
[White "Winner"]
[Black "Loser"]
[Result "1-0"]
[Termination "normal"]
[FEN "3r4/p4rPk/1b1q1P2/2p1p3/8/5NR1/5P1P/6RK w - - 0 1"]
[PlyCount "3"]
[Setup "1"]

 1. g8=Q+ ( 1. Rh3+ Kg8 2. Rh8#) 1... Rxg8 2. Rh3# 1-0

In general that works really great but I encountered some unexpected challenges
  • The problems are from a pre-computer area so their author obviously wasn't able to check them with an engine. This means in some problems the author misses a possible refutation for the defending side. Some problems announced as Mate in 2 are in fact Mate in 3, some problems don't have a solution at all or the given master solution is wrong.
  • Some problems have more than 1 correct solution. In some of those cases the author gives 2 solutions but I encountered problems with up to 11 correct choices for the first move.
  • In some problems the author looks for a best move to maybe win a piece but the engine might see another tactic leading to mate. So instead of going for the piece the engine selects another move leading to a distant forced mate. 

Intended solution Bb6 (winning the bishop) fails to Bh3+

Intended solution Qh6 (with idea Qg7#) fails to Re1#
11 moves lead to Mate in 2 (incl. all white king moves)

Especially the problems with multiple solutions are frustrating for kids if they find a correct move that is not in the list of correct solutions. They are really not relaxed about this. I'm talking from experience.

So I modified my tactics builder to run Stockfish in MultiPV mode with 12 lines. It will then include all lines with an evaluation equal to the best evaluation as alternative solutions. I originally inteded to use iCE as solving engine but iCE has no MultiPV mode yet. So I can't use iCE.

But overall I would say only 5% of the problems are somehow problematic. Overall its a good training set. By now I have a nice couple from the early volumes digitized. I hope it will help my boys a bit.