Echo transform parameters

Echo transform parameters look for targets that are transformed versions of the source. The transform is either a dihedral transform - a reflection about an axis or a combination of these - or it is a shift transform. An echo transform parameter does not allow a transformation that is an identity tranfsormation (which differs from its corresponding non-echo transformation).

Each echo transform parameter is associated with a set S of non-identity transforms and a square parameter. A source matches its target under an echo transform parameter if for some transform T in S, the target matches the source under the transformation of the square parameter by T.

Syntactically, an echo transform parameter is an echo transform keyword followed by a square parameter

    echotransformparameter:= echotransformkeyword square parameter
    echotransformkeyword := echodihedralkeyword | echoshiftkeyword 
    echodihedralkeyword := 'echoflip' | 'echoflipvertical' | 'echofliphorizontal' | 'echorotate90' 
    echoshiftkeyword := 'echoshift' | 'echoshifthorizontal' | 'echoshiftvertical'

Each echo transform parameter applies certain transforms to the target board before its argument square parameter comparison is performed. The transforms that are applied are described in the following table:

nametransformations
echoflip the seven non-identity rotations and reflections of the board
echoflipvertical reflection about vertical bisector
echofliphorizontal reflection about horizontal bisector
echorotate90 rotations by 90°, 180°, and 270°
echoshift non-identity orthogonal shifts
echoshiftvertical non-identity shifts in the vertical direction
echoshifthorizontal non-identity shifts in the horizontal direction

Echo transform parameters can be divided into two types: echo dihedral transform parameters and echo shift transform parameters. The echo dihedral transform parameters are those formed from the keywords echoflip, echoflipvertical, echofliphorizontal, and echorotate90. The echo shift transform parameters are formed from the keywords echoshift, echoshifthorizontal, and echoshiftvertical. These two categories of echo transform parameters are discussed in the next two sections.

echo dihedral transform parameters

A single dihedral transformation T transforms a square parameter as follows. The interpretation of sourcesquares, targetsquares, match, and mismatch is the same as before T is applied. In particular, the comparison set is computed and only squares in the comparison set are considered in comparing the source and target.

However, instead of comparing the contents of identical squares in the source and target positions, the transformed square parameter compares the contents of each square square in the comparison set in the source position with the contents of T square in the target position. Here T square is the result of applying the dihedral transform T to the square square.

An example of an echoflip transform that seeks targets that are a vertical reflection of its source is in echoflipvertical.cql. The relation filter there is:

relation
 (tomove match)
 echoflipvertical (mismatch 0)
The tomove parameter requires that the target and source have the same side to move. The echoflipvertical parameter requires that the target be a vertical flip of the source. Note that the target cannot be the same as the source because the identity transform is disallowed.

echo shift parameter

An echo shift parameter is analogous to the echo dihedral parameters discussed above except that the boundary effects of shifting a square off the board must be considered.

Conceptually, both the source and the target are embedded in the center of a 24x24 grid of squares to get source and target superboards. All squares not in the central 8x8 grid of squares in the superboard are set to empty. The shifts and comparisons work as in the dihedral case, except that the entire target superboard is shifted. The comparison of squares is done only when the untransformed squares are both in the comparison set, which must arise from the central board. The number of mismatches is capped at 64.

As an example, consider a search for chameleon echoes that seeks game with two positions, one of which is a shifted version of the other such that the pieces switch the colors of the squares they are on. An example comes from the following study:
Y. Hoch
1.p Mandil MT
1980
try: 12.? solution: 16.Qg1+
This study would be found by the following CQL code:

cql(input heijden.pgn variations)
K on darksquares
relation
   K on lightsquares
   (tomove match)
   echoshift (mismatch 0)
sort "Number of pieces" [Aa] 4 32

An example of using echoshift to find chameleon echoes is in chameleon-echo.cql