bishbosh-0.0.0.5: Plays chess.

BishBosh.Component.Move

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Defines one move (actually just a half move AKA "ply") of a piece.
Synopsis

# Types

## Type-synonyms

type NMoves = Int Source #

• A number of moves.
• CAVEAT: this may be a number of plies or full moves (i.e. a ply by White & a ply by Black)

type NPlies = NMoves Source #

A number of half-moves into a game.

data Move x y Source #

• A move of a piece.
• Most modern chess-notations (except Standard Algebraic) start with similar information, but also define ancillary information which is captured in MoveType.
Instances

# Constants

Used to qualify XML.

The constant number of plies per move.

castlingMovesByLogicalColour :: (Enum x, Enum y, Eq y, Ord x) => ByLogicalColour [(MoveType, Move x y, Move x y)] Source #

Defines by logical colour, the list of (move-type, King's move, & Rook's move) for each type of Castle.

# Functions

measureDistance :: (Enum x, Enum y, Num distance, Ord distance) => Move x y -> Vector distance Source #

Measures the signed distance between the ends of the move.

interpolate :: (Enum x, Enum y, Ord x, Ord y) => Move x y -> [Coordinates x y] Source #

Generates a line of coordinates covering the half open interval (source, destination].

Measure the change in the square of the radius from the centre of the board, resulting from the specified move.

## Constructors

mkMove :: (Eq x, Eq y) => Coordinates x y -> Coordinates x y -> Move x y Source #

Smart constructor.

## Predicates

isPawnDoubleAdvance :: (Enum x, Enum y, Eq y) => LogicalColour -> Move x y -> Bool Source #

• Whether the specified move is a Pawn's initial double-advance.
• CAVEAT: failing this test guarantees that the move isn't a Pawn's double-advance, but passing only guarantees that it is, if it was a Pawn which moved & that the move is valid.