# shift

Let i and j be integers between -7 and 7. The basic shift transform UiVj shifts a square i squares to the right and j squares up. (U and V are taken from the definitions of shiftvertical and shifthorizontal). Negative arguments shift in the opposite direction.

`U2V3 [a1,d3] ≡ [c4,f6]`
because if `a1` is shifted right two squares and up 3 squares it becomes `c4`; if `d3` is shifted right two squares and up 3 squares, it becomes `f6`.

As a special rule, suppose a square designator contains an entire rank, like `[a-h2,c4]` contains the entire second rank in addition to the `c4` square. Then any right or left shifts of squares on that rank are ignored. Thus,

```  U2V3 [a-h2,c4]
≡
[a-h5,e7]```

That is, U has no effect on full ranks, and likewise V has no effect on full files. A basic shift transform can be extended to a basic shift transform of an arbitrary filter: each square designator appearing in the filter is shifted by the specified amount.

Sometimes a basic shift transform will result in an empty square designator. For example,

`  U7V7 [a-h2,c4]`

will be empty. Any empty square designator makes the whole filter containing that empty square designator empty as well.

`shift` is a transform filter that represents each of the 225 basic shift transforms including the identity.

The effect of `shift F` is first to create the 225 distinct filters that result from applying each of the basic shift transforms to F. Empty filters and repetitions are deleted, and the resulting set is called the orbit of `shift F`.

For example, the orbit of `shift Ka1` is 64 distinct filters, `Ka1`, `Kb1`, and so on.

On the other hand, the orbit of `shift {Ka1 ka8}` only contains 8 filters, namely `{Ka1 ka8}`, `{Kb1 kb8}` and so on. Any vertical shift results in one of the kings going off the board, and which makes the corresponding filter empty.

If F is a numeric filter then so is `shift F` in which case its value is the maximum of the values of the matching transformed versions of F.

`shift count F`

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

`shift count find Qa1`

is the number of different squares on which there is a white queen in the game.