Skip to content

Statistics about common tactical motifs in the opening phase of chess games

Notifications You must be signed in to change notification settings

nilslindemann/Chess_Opening_Tactics_Frequency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chess Opening Tactics Frequency

How often do specific tactical themes happen in chess openings?

Of course, that question can not be answered precisely, because tactical motifs in chess are not clearly defined and often interwove.

But we can guess, and in order to do so, I wrote some CQL scripts which define some patterns, which are often seen in the opening phase. Using the scripts, I then searched in a PGN database with 372,000 GM games. The search was done within the first twenty moves of each game - the opening phase. Most games fit the themes quite well, though there are some false positives. But I wanted to keep the scripts simple.

Here is what I got:

Theme Example for the theme N. o. games found
Piece sacrifice f7 Mahescandra - Cochrane, Kolkata 1850 741
Knight sacrifice d5 Kasparov - Salov, Barcelona 1989 679
Piece sacrifice b5 Morphy - Isouard, Paris 1858 573
Piece sacrifice e6 Tal - Chikovani, Gori 1968 552
Piece sacrifice h6 Fisher - Steinitz, England 1872 549
Piece sacrifice g5 Mahescandra - Cochrane, Kolkata 1850 494
Knight sacrifice f7 Bareev - Sakaev, Moscow 2001 387
Piece sacrifice g6 Kramnik - Lautier, Tilburg 1998 358
Bishop sacrifice f7 Morphy - Muarian, New Orleans 1866 302
Knight sacrifice f5 Spassky - Van Oosterom, Antwerp 1955 288
Pawn sacrifice e6 Akopian - Gabriel, Baden-Baden 1996 171
Exchange sacrifice c3 Ader Hausman - Fischer, Santiago 1959 114
Exchange sacrifice f6 Mongredien - Harrwitz, London 1860 104
Bishop sacrifice h7 Wilke - Priwonitz, Hamburg 1833 59
Smothered mate f7 is an aspect Malakhov - Sanikidze, Chartres 2017 28
Pawn sacrifice d6 Jones - Chanda, Abudhabi 2015 26
Double bishop sacrifice h7, g7 Nimzowitsch - Tarrasch, St Petersburg 1914 12
Smothered mate Morphy - Amateur, Paris 1859 6
Pawnchain c5-d6-e5, piece sacrifice c5 Korchnoi - Nijboer, Netherlands 1994 3
Pawnchain f5-e6-d5, piece sacrifice f5 Tarrasch - Marshall, Nuremberg 1905 3

The PGNs containing these games are inside the folder output.

How it was done

Attached to this repository are:

  • The CQL scripts used for the search, these are files with the extension *.cql.
  • The input game database, input.pgn, it is contained in the input games.7z.
  • The used CQL interpreter, cql.exe (version 6.0.5) contained in the cql interpreter.7z. If you are on Linux or macOS, replace this binary with a download from the official CQL website.

The input database consists of games, where

  • one player is above 2700 ELO, or
  • both are above 2500, or
  • the game was played before 1900.

Running queries

First extract the input games.7z and the cql interpreter.7z into this directory.

On Windows, to (re-)run a script on the database, drag the script on the convenience draghere.bat. The results will be written to the output folder, overwriting the results of previous runs.

Instead of the input.pgn you can of course also use your own PGN database. Name it input.pgn or edit the draghere.bat to match its name. For example, you could use your games played on Lichess.

It will take some time to run a script on a huge database. To speed up the queries, you can first run a generic script on the database, and then run the refined script on the output PGN of the first run. See the CQL command line reference for the available command line options.

Learning CQL

The scripts in this repository use the following CQL filters and symbols (leaving the obvious mathematical operators and the piece designators away). They are documented in the above links.

  • Filters without parameters: wtmbtmmate
  • Filters with one parameter: flipcolorresultmovenumberpower#
  • Filters with two parameters: attacksattackedbyray
  • Filters with three parameters: pin
  • Filters with a variable amount of parameters: line
  • Piece / square / position matching filters: aA_.
  • Grouping filters: {}[]() • (whitespace between filters, which is an implicit AND)
  • Filters which are parts of other filters: -->*

Copyrights

I put the scripts and the database into the public domain (chess games are anyway). The copyright owners of CQL are Gady Costeff and Lewis Stiller.

Credits

... go to Gady Costeff and Lewis Stiller for creating the CQL language, and to haydoooke for his documentation of CQL.

Written by Nils Lindemann in 2021-4-13. Last update: 2022.11.15

About

Statistics about common tactical motifs in the opening phase of chess games

Topics

Resources

Stars

Watchers

Forks