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 :: NPlies
- 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]
- 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 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 :: NPlies Source #
The constant number of plies per move.
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]
.
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.