# flipvertical

`flipvertical`

is a transform filter corresponding to the following 2 basic transforms.
**id**, the identity**reflect**: reflection about the vertical bisector._{v}

`flipvertical`

is normally called with a single argument filter, *F*:

flipverticalF

`flipvertical`

also accepts an optional `count`

parameter.
`flipvertical `

matches the current position if any transformation of *F**F* by one of the 2 basic transforms above matches the current position. These two transforms are examples of dihedral transforms.

For example, suppose *F* is the filter `{Ka1 kh8}`

, matching a position in which the white king is on `a1`

and the black king is on `h8`

. If we transform this filter by **reflect _{v}** we get the new filter

`{Kh1 ka8}`

. The filters that results from transforming `{Ka1 kh8}`

by all the elements of `flipvertical`

, which is to say the identity and reflection about the vertical bisector, are:
{Ka1 kh8} {Kh1 ka8}

The filter `flipvertical {Ka1 kh8}`

will thus match a position if either of these two filters match the position, that is, if the white king is on `a1`

or `h1`

and the black king is on the opposite corner.
(This can also be done, more efficiently, via `k==diagonal 7 K[a1,h1]`

)

If *F* is a set filter then so is

flipverticalF

in which case its value is the union of the values of each of the sets represented by each transformed version of *F*.

For example,

`flipvertical a1`

is the set `[a1,h1]`

.

If *F* is a numeric filter then so is `flipvertical `

in which case its value is the maximum of the values of *F**F* and the value of the reflection of *F* about the vertical bisector.

flipvertical countF

is a numeric filter whose value is the number of distinct matching transformed versions of *F*. For example, if the current position is the initial position, then

flipvertical count find {Qa1 qh8}

is equal to 0 if neither `{Qa1 qh8}`

nor `{Qh1 qa8}`

occur in the game; is equal to 1 if exactly one of these configurations does; and is equal to 2 if both of them do.

The `flipvertical`

filter also modifies directions parameters and filters. Thus,

flipvertical ray right (R K)

will match if and only if

ray horizontal (R K)

matches.