ChessAssistantDocs : CQLCa9vsCQL301

HomePage :: Categories :: PageIndex :: RecentChanges :: RecentlyCommented :: Login/Register

Comparison of Chess Assistant 9 and CQL 3.01


Chess Assistant 9 implements all the features of CQL 3.01, but also adds some new features and graphical extensions. It is interesting to compare the core CQL 3.01 functionality, as defined and implemented by the authors of CQL, and the implementation in Chess Assistant 9. Running the same query on the same game collection in both applications should give identical results. Fortunately that is exactly what happens almost without exception. There are, however, three exceptions that I have run into so far.

Stalemate?

This is the game fraction used for this test:

[Event "CQL Stalemate Test"]
[Site "?"]
[Date "2006.??.??"]
[Round "?"]
[White "?"]
[Black "?"]
[Result "1-0"]
[SetUp "1"]
[FEN "8/8/3p2p1/3Pk1P1/3pPp2/5P2/p1PPK3/B7 w - - 0 1"]

1.c4 dxc3 2.Bxc3# 1-0

The query is very simple and searches for a stalemate:

 (match
 :pgn cqleperror.pgn
 :output cql-match.pgn
 (position :stalemate)
) 

Note that the :pgn and :output are not needed when running this query in Chess Assistant 9. This is the initial position in the game:
Initial position
Obviously there is no stalemate after after 1. c4 and Chess Assistant 9 sees that and correctly doesn’t find any stalemate position in this game. In order to compare this with the CQL 3.01 implementation found at http://www.rbnn.com/cql/ the game above should be saved to cqleperror.pgn and the query needs to be saved as a CQL file. If it is saved under the name stalemate.cql the following command line will run the query:

 cql stalemate.cql 

The results, which are written to cql-match.pgn look like this:
{Original game: 1}
1.c4 {MATCH} 1...dxc3 2.Bxc3# 1-0

Notice the {MATCH} after 1. c4. It means that the position after that move matches the query conditions. According to that it should be a stalemate, which isn’t true.


A move or not a move: that is the question

Here is another example where the original CQL implementation and Chess Assistant 9 don’t agree. The following query can be used to show the difference:
(match
  :pgn disccheck.pgn
  :output out.pgn
  :forany wpiece A
  (position
	:sequence(
	  (position :movefrom $wpiece)
	  (position :attackcount $wpiece k 0)
	)
  )
)

This query looks at the first move by each white piece in the game. If the move doesn’t deliver check there is a match. The query was run against the following game as an example. The matches found by CQL 3.01 are shown:
[Event "Tournament"]
[Site "Frymburk (Czech Republic)"]
[Date "2000.??.??"]
[Round "3"]
[White "Korinek Ondrej (CZE)"]
[Black "Stolc M"]
[Result "1-0"]

{Original game: 1 MATCH}
1.e4 e5 {MATCH} 2.Bc4 Nf6 {MATCH} 3.d4 Nc6 {MATCH} 4.Nf3 d6 5.dxe5 Nxe5 6.Nxe5
dxe5 7.Bxf7+ Ke7 8.Qxd8+ Kxd8 {MATCH} 9.Bg5 Bd6 {MATCH} 10.Nc3 Ke7 11.Bb3 Bb4
12.Bd2 Rf8 {MATCH} 13.f3 Bc5 14.Nd5+ Kd6 {MATCH} 15.O-O-O Nxd5 16.Bxd5 c6 17.
Bb3 Kc7 {MATCH} 18.Rhe1 b6 19.Bc4 b5 20.Bb3 a5 {MATCH} 21.a4 Bb6 22.axb5 cxb5
23.Bd5 Ra7 24.Be3 b4 25.Bxb6+ Kxb6 26.Bc4 Rf6 {MATCH} 27.Rd5 Rc6 {MATCH} 28.b3
Be6 29.Rb5+ Kc7 30.Bxe6 Rxe6 31.Rd1 Rd6 32.Rxe5 Rxd1+ 33.Kxd1 Kd6 34.Rd5+ Ke6
35.Kd2 a4 36.bxa4 Rxa4 37.Rb5 Ra1 38.Rxb4 Rg1 {MATCH} 39.g4 Rg2+ 40.Ke3 Rxc2
{ MATCH} 41.h4 h6 42.Rb6+ Ke7 43.h5 Rc7 44.Kf4 Kf7 45.Kf5 g5 46.hxg6+ Kg7 47.e5
h5 48.gxh5 Kh6 49.Rb8 Rc3 50.Rh8+ Kg7 51.Rh7+ Kg8 52.f4 Rc6 53.Rd7 Rc8 54.h6 
Rf8+ 55.Kg5 Re8 56.f5 Rc8 57.f6 Rb8 58.f7+ Kh8 59.g7+ Kh7 60.g8=Q+ Rxg8+ 61.
fxg8=Q+ Kxg8 62.Kf6 Kh8 63.Kg6 Kg8 64.Rd8# 1-0

Chess Assistant 9 gives the same result, except it doesn’t find a match in 27. Rd5. Here is what the position looks like before that move:
Position before 27. Rd5
By giving a match for this position CQL 3.01 counts 27. Rd5 as the first move by the rook on d1. But this rook was on a1 in the initial position, so obviously it has moved, but it was a special move. The rook landed on d1 when white castled on move 15. So the question is if castling should only be counted as a move by the king as CQL 3.01 seems to do? Or should it be counted as the first move for both the king and the rook as Chess Assistant 9 does? It certainly looks odd to see 27. Rd5 counted as the first move by the rook, so Chess Assistant seems to handle this case as chessplayers would expect.

Matchcount confusion

This query, which can be found in the CQL 3.01 documentation, searches for games where the same piece delivers at least 30 checks.
(match
	:pgn heijden.pgn
	:output out.pgn
	:forany checker A
	(position
	    :btm
	    :attackcount $checker k 1
	    :matchcount 30 1000
	)
)

Both CQL 3.01 and Chess Assistant 9 mark all positions in the game where the piece in question gives check to the black king.

The following query is similar, but the position list specifies a sequence. In order for a position to match, the tagged piece must make the next move and it must be a non-checking move.
(match
	:forany wpiece A                           ; Loop through white pieces
	(position
	  :sequence(
	      (position :movefrom $wpiece)         ; The tagged piece must move next
	      (position :attackcount $wpiece k 0)  ; The tagged piece does not give check
	  )
	  :matchcount 30 1000                      ; At least 30 positions must match in the game
	)
)

By comparision with the previous query this one should be expected to return games where the same piece makes at least 30 non-checking moves in a game. That is actually what both Chess Assistant 9 and CQL 3.01 seem to do, but there is a difference when you check the marked positions in the matching games. CQL 3.01 marks all positions in the games where any white pieces makes a non-checking move. In other words, the only positions (with white to move) that are not marked is where a white piece delivers check on the next move. Chess Assistant 9, on the other hand, restricts the marks to the piece that actually makes the 30 moves without checking the black king. The difference can be seen from this game fraction where only the white queen made more than 30 non-checking moves. First the output from CQL 3.01:
{Original game: 2 MATCH}
1.d4 Nf6 {MATCH} 2.c4 e6 {MATCH} 3.g3 d5 {MATCH} 4.Nf3 Be7 {MATCH} 5.Bg2 O-O {
MATCH} 6.O-O dxc4 {MATCH} 7.Qc2 a6

Any position followed by a non-checking white move is marked. Chess Assistant 9, however, correctly only marks moves by the white queen:
1.d4 Nf6 2.c4 e6 3.g3 d5 4.Nf3 Be7 5.Bg2 O-O 6.O-O dxc4 {MATCH} 7.Qc2 a6


Conclusion

The implementation of CQL in Chess Assistant 9 seems to be very good. In cases where its interpretation of CQL does not agree with the original implementation of CQL 3.01, Chess Assistant seems to have chosen the correct or at least the more logical way to interpret CQL.

There are no comments on this page. [Add comment]

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.0330 seconds