I am looking to search for combinations similar to the one in Karpov - Taimanov, 1977 - a knight check, is followed by opening of an 'h' file, and the rook comes with decisive effect because attacker's queen covers the diagonal. I am only learning CQL and any tips on how to get started on constructing a query would be much appreciated -

[Event "October Revolution 60th Anniversary"]
[Site "Leningrad URS"]
[Date "1977.06.25"]
[EventDate "1977.??.??"]
[Round "1"]
[Result "0-1"]
[White "Anatoly Karpov"]
[Black "Mark Taimanov"]
[ECO "B32"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "76"]
[FEN " "]

1. e4 c5 2. Nf3 Nc6 3. d4 cxd4 4. Nxd4 a6 5. c4 e5 6. Nb3 Nf6
7. Nc3 Bb4 8. f3 O-O 9. Be3 d6 10. Rc1 b6 11. Bd3 Bc5 12. Qd2
Be6 13. Nxc5 bxc5 14. O-O Nd4 15. Nd5 Nd7 16. f4 Rb8 17. f5
Bxd5 18. cxd5 Qb6 19. Rf2 f6 20. Rc4 a5 21. Ra4 Ra8 22. Qe1
Ra7 23. b3 Rfa8 24. Rb2 Qc7 25. Bd2 Nb6 26. Rxa5 c4 27. Bf1
Rxa5 28. Bxa5 Qc5 29. Bxb6 Qxb6 30. Kh1 cxb3 31. axb3 g6
32. fxg6 hxg6 33. b4 Kg7 34. b5 f5 35. exf5 Nxf5 36. Rb3 Qd4
37. b6 Ra1 38. Rb1 Ng3+ {analysis: 39. hxg3 Ra8} 0-1
  • 2
    What is CQL? If you are talking about Structured Query Language ("SQL", "See-qual", "Ess-Que-El"), then good luck writing a query for that.
    – Priyome
    Sep 4, 2017 at 15:19
  • 3
    @priyome, Chess Query Language. There have been some other questions concerning it on the site if you're curious.
    – ETD
    Sep 6, 2017 at 3:38

1 Answer 1


I'm still working out the full answer, but this is a start:

flipcolor {
    wtm check ng3 Pg2 Ph2 Kh1 r attack (q g1) not {
        square $x in h3-8 a on $x
    result 0-1

This gets down to 13 games from over 2 million and includes the Karpov - Taimanov game. I still haven't figured out a way to deal with the rook, but this gets a game list small enough to look through. The not square bits could be taken out to expand the search to a couple of hundred games, that was just looking for the h file to not be blocked by black pieces for the later rook move.

I used the above in the latest Scid vs. PC codebase, which has CQL support by adding cql() to the beginning and running it in the CQL search vs. what is ChessBase Big Database 2017 updated last month.

  • thanks! I get similar results in ScidVsPC-19, although on a different dataset.
    – Joe
    Jul 21, 2018 at 22:59
  • Other possibilities would be to look for a bishop attacking the g1 square instead of the queen. With the bishop attacking g1 and having a r on the board I find 20 games, and with the bishop and a q on the board I find 11 games. The first games that came up in both of those searches have the combination. I haven't looked at the other games. Jul 22, 2018 at 1:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.