Answers.Body: <blockquote>
  <p>Is there a software I can input these generic statements and find a
  list of games which have these conditions satisfied</p>
  </blockquote>
  <p>Of course not! Natural language interrogation of databases has a long way to go before it reaches this stage. Engines require queries to be formatted in some suitable way.</p>
  <p>What there is is something called <a href="https://en.wikipedia.org/wiki/Chess_Query_Language" rel="nofollow noreferrer">Chess Query Language</a> (CQL). In the same way that SQL (Structured Query Language) allows you to interrogate a relational database to extract useful information, so CQL allows you to interrogate the chess equivalent, a PGN file containing chess games.</p>
  <p>The original website supporting CQL died but was preserved by the Archive project and is available <a href="https://web.archive.org/web/20140130143815/http://www.rbnn.com/cql/" rel="nofollow noreferrer">here</a>. The associated old version of the software can be downloaded <a href="https://web.archive.org/web/20160226050834/http://www.rbnn.com/cql/cql.zip" rel="nofollow noreferrer">here</a>.</p>
  <p><strong>The latest version is available <a href="http://www.gadycosteff.com/cql/" rel="nofollow noreferrer">here</a></strong>.</p>
  <p>As the introduction from the old version makes clear CQL is a very powerful tool for interrogating chess databases:</p>
  <blockquote>
  <p>Chess Query Language (CQL) was designed to allow researchers, authors, and players to search for games, problems, and studies that match specific themes.
  You specify the theme you are looking for, and the database to look for them, in CQL. Then you run this CQL file using cql.exe . This creates a new PGN file that has all the games matching your theme.</p>
  </blockquote>
  <blockquote>
  <p>CQL specifies a small but powerful set of primitives to define chess themes. CQL can find much more complex themes than any other chess program. Users have searched for themes like stalemates with multiple pins; games in which the same position recurs but with the winning side missing just one piece; Nowotny and Grimshaw themes, games with some number of captures on a single square, games with a certain number of black and white passed pawns, and many more.</p>
  </blockquote>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-11T16:12:12.427Z
Answers.Text: thanks for the old link too. I got the chance to see more archived pages and found out that earlier they also made a GUI friendly version too.
Answers.UserDisplayName: Rahul Shah
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-08T16:33:05.463Z
Answers.LastActivityDate: 2020-12-08T17:28:35.637Z
Answers.LastEditDate: 2020-12-08T17:28:35.637Z
Answers.UserDisplayName: Brian Towers
Answers.Body: <p>As Brian mentioned, CQL (Chess Query Language) is the most capable tool for the job.  The current version of CQL at the time of this writing is 6.0.5 and the current website is <a href="http://www.gadycosteff.com/cql/" rel="noreferrer">http://www.gadycosteff.com/cql/</a>.  The site provides lots of examples and comprehensive documentation.  Below are queries that will find games matching your three examples to give you an idea of what CQL looks like in practice.</p>
  <p><strong>More than 10 checks in a game</strong></p>
  <pre><code>cql()
  initial sort &quot;total checks&quot; find all check &gt; 10
  </code></pre>
  <p>This will find all games where check was delivered (by both sides) more than 10 times in a game.  The matching games will be sorted in descending order by the number of checks delivered (the first game in the output will be the one with the most checks) and will contain a start-of-game comment with the number of checks that appeared in the game.  For example, <a href="https://lichess.org/mz7uv1rv" rel="noreferrer">here</a> is a game from lichess.org that was found using this query with 81 checks.  By default, the query will also add a comment to each move that matching the <code>find</code> filter (i.e. each move that is a check).  The <code>find</code> filter is described in detail <a href="http://www.gadycosteff.com/cql/find.html" rel="noreferrer">here</a>.</p>
  <p><strong>Consecutive checks</strong></p>
  <p>The CQL website provides many <a href="http://www.gadycosteff.com/cql/examples.html" rel="noreferrer">examples</a>.  The <code>consecutive-checks.cql</code> example finds games with 5 or more consecutive checks.  The query provided there is:</p>
  <pre><code>cql(input heijden.pgn)
  sort &quot;number of consecutive checks&quot;
    line 5 100 nestban
      --&gt; check+
  </code></pre>
  <p>The <code>sort</code> filter will again cause the games to be sorted by the number of most consecutive checks.  A comment will be inserted for each checking move in the longest line of checks for each matching game.  Documentation for the <code>line</code> filter used in this query is found <a href="http://www.gadycosteff.com/cql/line.html" rel="noreferrer">here</a>.</p>
  <p><strong>Winning side has King crossing middle rank</strong></p>
  <p>The following query will find all decisive games where the winning side's King moved to the opponent's side of the board at some point.  The first time the King crossed into enemy territory will be commented.  The query is written from the perspective of White (the filter <code>result 1-0</code> means White won and <code>Ka-h5-8</code> matches a position where the White king is present on ranks 5-8) but matches for both White and Black using the <code>flipcolor</code> query (the <code>flipcolor</code> query is described <a href="http://www.gadycosteff.com/cql/flipcolor.html" rel="noreferrer">here</a>).</p>
  <pre><code>cql()
  initial
  flipcolor { result 1-0 find Ka-h5-8 }
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-11T16:16:29.153Z
Answers.Text: Wow!!Thanks a ton !! Its gonna be a huge blessing to witness and experience the power of this epic software!
Answers.UserDisplayName: Rahul Shah
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-08T17:52:19.790Z
Answers.LastActivityDate: 2020-12-08T17:52:19.790Z
Answers.UserDisplayName: Robert Gamble
Body: <p>Suppose one wants to find:</p>
  <blockquote>
  <ol>
  <li>A list of games where White/Black gave each other check more than 10 times.</li>
  </ol>
  </blockquote>
  <blockquote>
  <ol start="2">
  <li>A list of games where there were Black and White gave each other check in consecutive steps</li>
  </ol>
  </blockquote>
  <blockquote>
  <ol start="3">
  <li>A list of games where the king crossed the middle rank and still won</li>
  </ol>
  </blockquote>
  <p>And so on.</p>
  <p>Is there a software I can input these generic statements and find a list of games which have these conditions satisfied</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-09T02:37:12.130Z
Comments.Text: in almost any game that leads to the endgame you will find a king that crossed the middle of the board. In fact, I think that most games will lead to that... (assuming that it isn’t bullet, cuz there the game usually ends with a timeout)
Comments.UserDisplayName: fartgeek
Tags: <engines><software><programming>
Title: Is there a software where we can query historical games to find patterns without inputting the exact chess position?
ThreadText: # Is there a software where we can query historical games to find patterns without inputting the exact chess position?
  
  (Asked by: username_0 on 2020-12-08)
  
  Suppose one wants to find:
  
  > 1. A list of games where White/Black gave each other check more than 10 times.
  
  > 2. A list of games where there were Black and White gave each other check in consecutive steps
  
  > 3. A list of games where the king crossed the middle rank and still won
  
  And so on.
  
  Is there a software I can input these generic statements and find a list of games which have these conditions satisfied
  
  **Tags:** engines, software, programming
  
  > **Comments:**
  > **username_1**: in almost any game that leads to the endgame you will find a king that crossed the middle of the board. In fact, I think that most games will lead to that... (assuming that it isn’t bullet, cuz there the game usually ends with a timeout)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2020-12-08. Score: 7 | Accepted answer
  
  As Brian mentioned, CQL (Chess Query Language) is the most capable tool for the job.  The current version of CQL at the time of this writing is 6.0.5 and the current website is http://www.gadycosteff.com/cql/.  The site provides lots of examples and comprehensive documentation.  Below are queries that will find games matching your three examples to give you an idea of what CQL looks like in practice.
  More than 10 checks in a game
  cql()
  initial sort "total checks" find all check > 10
  
  This will find all games where check was delivered (by both sides) more than 10 times in a game.  The matching games will be sorted in descending order by the number of checks delivered (the first game in the output will be the one with the most checks) and will contain a start-of-game comment with the number of checks that appeared in the game.  For example, here is a game from lichess.org that was found using this query with 81 checks.  By default, the query will also add a comment to each move that matching the find filter (i.e. each move that is a check).  The find filter is described in detail here.
  Consecutive checks
  The CQL website provides many examples.  The consecutive-checks.cql example finds games with 5 or more consecutive checks.  The query provided there is:
  cql(input heijden.pgn)
  sort "number of consecutive checks"
    line 5 100 nestban
      --> check+
  
  The sort filter will again cause the games to be sorted by the number of most consecutive checks.  A comment will be inserted for each checking move in the longest line of checks for each matching game.  Documentation for the line filter used in this query is found here.
  Winning side has King crossing middle rank
  The following query will find all decisive games where the winning side's King moved to the opponent's side of the board at some point.  The first time the King crossed into enemy territory will be commented.  The query is written from the perspective of White (the filter result 1-0 means White won and Ka-h5-8 matches a position where the White king is present on ranks 5-8) but matches for both White and Black using the flipcolor query (the flipcolor query is described here).
  cql()
  initial
  flipcolor { result 1-0 find Ka-h5-8 }
  
  > **Comments:**
  > **username_0**: Wow!!Thanks a ton !! Its gonna be a huge blessing to witness and experience the power of this epic software!  
  
  ---
  
  ### Answer by username_2 on 2020-12-08. Score: 1
  
  > Is there a software I can input these generic statements and find a
  > list of games which have these conditions satisfied
  
  Of course not! Natural language interrogation of databases has a long way to go before it reaches this stage. Engines require queries to be formatted in some suitable way.
  
  What there is is something called [Chess Query Language](https://en.wikipedia.org/wiki/Chess_Query_Language) (CQL). In the same way that SQL (Structured Query Language) allows you to interrogate a relational database to extract useful information, so CQL allows you to interrogate the chess equivalent, a PGN file containing chess games.
  
  The original website supporting CQL died but was preserved by the Archive project and is available [here](https://web.archive.org/web/20140130143815/http://www.rbnn.com/cql/). The associated old version of the software can be downloaded [here](https://web.archive.org/web/20160226050834/http://www.rbnn.com/cql/cql.zip).
  
  **The latest version is available [here](http://www.gadycosteff.com/cql/)**.
  
  As the introduction from the old version makes clear CQL is a very powerful tool for interrogating chess databases:
  
  > Chess Query Language (CQL) was designed to allow researchers, authors, and players to search for games, problems, and studies that match specific themes.
  > You specify the theme you are looking for, and the database to look for them, in CQL. Then you run this CQL file using cql.exe . This creates a new PGN file that has all the games matching your theme.
  
  > CQL specifies a small but powerful set of primitives to define chess themes. CQL can find much more complex themes than any other chess program. Users have searched for themes like stalemates with multiple pins; games in which the same position recurs but with the winning side missing just one piece; Nowotny and Grimshaw themes, games with some number of captures on a single square, games with a certain number of black and white passed pawns, and many more.
  
  > **Comments:**
  > **username_0**: thanks for the old link too. I got the chance to see more archived pages and found out that earlier they also made a GUI friendly version too.  
  
  ---
  
  