Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Defines one move (actually just a half move AKA "ply") of a piece.
Synopsis
- type NMoves = Int
- type NPlies = NMoves
- data Move x y
- tag :: String
- nPliesPerMove :: NMoves
- castlingMovesByLogicalColour :: (Enum x, Enum y, Eq y, Ord x) => ByLogicalColour [(MoveType, Move x y, Move x y)]
- measureDistance :: (Enum x, Enum y, Num distance, Ord distance) => Move x y -> Vector distance
- interpolate :: (Enum x, Enum y, Ord x, Ord y) => Move x y -> [Coordinates x y]
- getDeltaRadiusSquared :: (Fractional radiusSquared, Integral x, Integral y) => Move x y -> radiusSquared
- mkMove :: (Eq x, Eq y) => Coordinates x y -> Coordinates x y -> Move x y
- isPawnDoubleAdvance :: (Enum x, Enum y, Eq y) => LogicalColour -> Move x y -> Bool
Types
Type-synonyms
- A number of moves.
- CAVEAT: this may be a number of plies or full moves (i.e. a ply by
White
& a ply byBlack
)
- 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
(Eq x, Eq y) => Eq (Move x y) Source # | |
(Ord x, Ord y) => Ord (Move x y) Source # | |
Defined in BishBosh.Component.Move | |
(Enum x, Enum y, Ord x, Ord y, Read x, Read y) => Read (Move x y) Source # | |
(Show x, Show y) => Show (Move x y) Source # | |
(NFData x, NFData y) => NFData (Move x y) Source # | |
Defined in BishBosh.Component.Move | |
Opposable (Move x y) Source # | |
Defined in BishBosh.Component.Move getOpposite :: Move x y -> Move x y Source # | |
(Enum x, Enum y) => Orientated (Move x y) Source # | |
Defined in BishBosh.Component.Move isDiagonal :: Move x y -> Bool Source # isParallel :: Move x y -> Bool Source # isStraight :: Move x y -> Bool Source # | |
Enum x => ReflectableOnY (Move x y) Source # | |
Defined in BishBosh.Component.Move reflectOnY :: Move x y -> Move x y Source # | |
Enum y => ReflectableOnX (Move x y) Source # | |
Defined in BishBosh.Component.Move reflectOnX :: Move x y -> Move x y Source # |
Constants
nPliesPerMove :: NMoves Source #
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]
.
getDeltaRadiusSquared :: (Fractional radiusSquared, Integral x, Integral y) => Move x y -> radiusSquared Source #
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 aPawn
which moved & that the move is valid.