Previous   Next   Download

A General Description of Fairy-Piece Movement

Leapers and Sliders

Pieces in FIDE Chess are either Leapers (which reach their final square in a single step and cannot be blocked) or Sliders (for which the step to the final destination is an arbitrary multiple of an elementary step, but which are blocked by the first obstacle they encounter along this line). Usually they are allowed to capture an enemy piece at their destination square, if this is not empty. Usually they can access all directions that are related to each other by the 8-fold symmetry of the board. But even in FIDE Chess the Pawn is a notale exception to both these rules.

Fairy pieces are of a much larger variety. Some of the most popular pieces are compounds of a Leaper and a Slider: the Chancellor and Archbishop, known from Capablanca Chess, are Rook-Knight and Bishop-Knight compounds, respectively. So where the movement rules FIDE Chess can be satisfactorily described by a table of directions (step vectors), and the Slider vs Leaper information can be trivially obtained from the piece type, fairy pieces in general will have to have this attribute to be specified for each step direction separately. To this end Fairy-Max has a second list for each piece type, next to the list of step vectors present in micro-Max. Another difference is that in micro-Max (for non-Pawns) only one of the vectors for opposite directions was stored, as the other could be derived from this by simple sign flip. In Fairy-Max all directions are explicitly spelled out, to allow for asymmetric pieces like the Pawn.

Other attributes of moves in a given direction are the allowed capture modes, one bit indicating if the piece can capture in that direction, the other if it can make non-captures. For FIDE pieces both would be set.


Some fairy-Chess pieces are Hoppers. Unlike Sliders, they are not blocked by an obstacle, but can hop over it (no matter if it is a friend or foe). Their moves can be partitioned into two parts: before and after the hop, with different properties (if only, that after the hop they lose the ability to hop again). Often they are not allowed to do anything at all (neither capture or non-capture) befor hopping, such as the Grasshopper, which moves in the same directions as a Queen, but can only land on the square directly after the piece they hop over. This latter piece is also known as 'the platform'. So after having cleared the platform, the Grasshopper behaves like an ordinary Leaper, but before it, it can neither capture nor non-capture. The only thing it is allowed to do is to skip over empty squares until he reaches the platform. The hop thus turns a skipping Slider into a normal Leaper.

The Cannon from Xiangqi (the Chinese variant of Chess) is another example of a Hopper. It moves like a Rook, but unlike the Grasshopper it is allowed to do non-captures before it reaches the platform. Afer having cleared the platform, it still moves like a Rook (i.e. it remains a Slider), but now it is only allowed to make captures. So this is a case where a non-capturing Slider turns into a capture-only Slider.

Some Xiangqi pieces are 'lame Leapers', i.e. their move can be blocked by a piece on a square that they cannot go to, but where supposed to jump over. E.g. the Xiangqi Elephant on a1 could move to c3, but not if b2 is occupied. Such a move can also be described as a two-step move, with different move-rights on each step: the first step can neither capture nor non-capture, but the second can do both. The first step is slider like (another step can follow if the square was not occupied), but the second step is leaper like (no further steps follow, even if the square was empty).

The Xiangqi Horse is an even more complicated example: it moves like a Knight, but is really supposed to make that move in two steps, one straight and one diagonal. If the first step is blocked, it cannot reach its target square. The move rights of the two steps are the same as for the Asian Elephant, but here also the step vector changes between the steps.


We see that changing the move type is quite common in fairy pieces. An even more extreme example is the Crooked Bishop, a Slider that zig-zags over the board (e.g. from c1, it reaches d2, c3, d4, c5, d6, c7, d8). The step vector thus alternates, although the move rights are always like an ordinary Slider. Of course the normal sliders can be considered as a degenerate case of such 'alternators', where the odd and even steps happen to be the same, both in direction and in move rights. Fairy-Max therefore considers all pieces either hoppers or alternators, with a primary step vector and move-rights bits, as well as a secondary. For hoppers it switches to the secondary set on hopping. For non-hoppers, it switches between primary and secondary set type on every step. For simplicity, only the bits that have to change between primary and secondary step are indicated in Fairy-Max, so that for the overwhelming majority of pieces that have all steps the same, the secondary part can described by a simple zero, simplifying the description.

With this description method (capture, noncapture, leaper and hopper bits plus a step vector, all two times, for each direction), almost all fairy pieces can be described. Pawn double moves and castlings are in fact examples of lame-Leaper moves, except that they have to satisfy some extra conditions, the most obvious one is that the piece must be virgin (i.e. it should not have moved before). A combijnation of move-right bits that would otherwise not be useful is used to trigger the relevant hard-coded tests. (Namely a leaper move withou capture or non-capture.)


The above scheme allows a wide variety of pieces to be defined in a purely table-driven way. This is implemented in Fairy-Max, where the table defining the pieces is read from a file fmax.ini at startup. By simple editing of this file, new pieces can be added. The file also contains the initial piece setup for the opening position. (And for more irregular opening positions, one can use the edit menu before starting.) Board sizes upto 12x8 are currently supported, also defined in the fmax.ini file. This makes Fairy-Max a very flexible engine for fairy Chess.