2

I'm looking for a CQL query that will return all positions with the below pawn structure for both White and Black

 [FEN "8/pp3ppp/4p3/8/3P4/8/PP3PPP/8 w - - 0 1"]
Rewan Demontay
  • 16,942
  • 4
  • 65
  • 109
Raul Diaz
  • 41
  • 2

1 Answers1

1

All right, so I found the following query for the pawn structure in the diagram above:

(match  ;query for IQP white 
      (position 
         :and (
            (position Pa2 Pb2 Pd4 Pf2 Pg2 Ph2 pa7 pb7 pe6 pf7 pg7 ph7)
            (position
            :piececount P[c2-7,e2-7] 0
            :piececount p[c2-7,d2-7] 0 )
         )
      )
)

For black though, I wanted to search for any IQP position, so I used this query:

    (match ;query for IQP black
      (position
        :and (
          (position pd5)
          (position
            :piececount P[a2-7] 1
            :piececount P[b2-7] 1
            :piececount P[c2-7] 0
            :piececount P[d2-7] 0
            :piececount P[e2-7] 1
            :piececount P[f2-7] 1
            :piececount P[g2-7] 1
            :piececount P[h2-7] 1

            :piececount p[a2-7] 1 
            :piececount p[b2-7] 1 
            :piececount p[c2-7] 0 
            :piececount p[d2-7] 1 
            :piececount p[e2-7] 0 
            :piececount p[f2-7] 1 
            :piececount p[g2-7] 1 
            :piececount p[h2-7] 1 
      )
     )
  )
)

Lame, but at least it works :)

Raul Diaz
  • 41
  • 2
  • I gather that this answer is based on the CQL 3 implementation? Since the latest implementation is 5.2, and ScidVsPC is based off that - I tried to port it over and had some difficulties. Have you tried it in CQL 5.2? The part below is valid in 5.2, but I can't get the piececount to work, so the query is incomplete. cql() Pa2 Pb2 Pd4 Pf2 Pg2 Ph2 pa7 pb7 pe6 pf7 pg7 ph7 – Joe Oct 24 '22 at 13:49