Gregor N. Purdy > Games-Chess-Referee-0.003 > Games::Chess::Rules

Download:
Games-Chess-Referee-0.003.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source  
kings_rook

The rook home position on the king's side.

queens_rook

The rook home position on the queen's side.

Vectors

vectors may be added, subtracted, and multiplied by a constant.

ahead

The space immediately `ahead', meaning away from the home row of the color.

Compound predicates

white_passant

(enemy(left) and pawn(left) and last(left + [0, 2], left)) or (enemy(right) and pawn(right) and last(right + [0, 2], right))

black_passant

(enemy(left) and pawn(left) and last(left - [0, 2], left)) or (enemy(right) and pawn(right) and last(right - [0, 2], right))

passant

(white and white_passant) or (black and black_passant)

The default action is for the piece to move to the destination and the enemy piece at that location to be removed. For specialty moves, these can be overridden.

It is assumed that any moves generated by these rules that produce off-board result positions are rejected.

Actions

mutate

After the move, mutat to the designated piece (used for pawn promotion in standard chess).

Formalized Plies

Pawns:

    [ahead]         if empty;
    [ahead * 2]     if empty and clear and home;
    [ahead + left]  if enemy or passant;
    [ahead + right] if enemy or passant.

Rooks:

    [0, ?]   if clear and not friend;
    [?, 0]   if clear and not friend.

Knights:

    [+1, +2] if not friend;
    [+1, -2] if not friend;
    [-1, +2] if not friend;
    [-1, -2] if not friend;
    [+2, +1] if not friend;
    [+2, -1] if not friend;
    [-2, +1] if not friend;
    [-2, -1] if not friend.

Bishops:

    [?,  ?]  if clear and not friend;
    [?, -?]  if clear and not friend.

Queens:

    [0, ?]   if clear and not friend;
    [?, 0]   if clear and not friend.
    [?, ?]   if clear and not friend;
    [?, -?]  if clear and not friend.

Kings:

    [-1, -1] if not friend and not threat;
    [-1,  0] if not friend and not threat;
    [-1, +1] if not friend and not threat;
    [ 0, -1] if not friend and not threat;
    [ 0, +1] if not friend and not threat;
    [+1, -1] if not friend and not threat;
    [+1,  0] if not friend and not threat;
    [+1, +1] if not friend and not threat;
    [king * 2]  if home and home[kings_rook] and clear[king, kings_rook];
    [queen * 3] if home and home[queens_rook] and clear[king, queens_rook];

We still need notations for the rook movements during castling.

Globally: not threat[king];