# fliphorizontal

`fliphorizontal`

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

`fliphorizontal`

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

fliphorizontalF

`fliphorizontal`

also accepts an optional `count`

parameter.
`fliphorizontal `

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 _{h}** we get the new filter

`{Ka8 kh1}`

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

by all the elements of `fliphorizontal`

, which is to say the identity and reflection about the horizontal bisector, are:
{Ka1 kh8} {Ka8 kh1}

The filter `fliphorizontal {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 `a8`

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

)

If *F* is a set filter then so is

fliphorizontalF

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,

`fliphorizontal a1`

is the set `[a1,a8]`

.

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

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

fliphorizontal 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

fliphorizontal count find {Qa1 qh8}

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

nor `{Qa8 qh1}`

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 `fliphorizontal`

filter also modifies directions parameters and filters. Thus,

fliphorizontal ray up (R K)

will match if and only if

ray vertical (R K)

matches.