bishbosh-0.0.0.3: Plays chess.

Safe HaskellNone
LanguageHaskell2010

BishBosh.Component.Move

Contents

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

(Eq x, Eq y) => Eq (Move x y) Source # 

Methods

(==) :: Move x y -> Move x y -> Bool #

(/=) :: Move x y -> Move x y -> Bool #

(Ord x, Ord y) => Ord (Move x y) Source # 

Methods

compare :: Move x y -> Move x y -> Ordering #

(<) :: Move x y -> Move x y -> Bool #

(<=) :: Move x y -> Move x y -> Bool #

(>) :: Move x y -> Move x y -> Bool #

(>=) :: Move x y -> Move x y -> Bool #

max :: Move x y -> Move x y -> Move x y #

min :: Move x y -> Move x y -> Move x y #

(Enum x, Enum y, Ord x, Ord y, Read x, Read y) => Read (Move x y) Source # 

Methods

readsPrec :: Int -> ReadS (Move x y) #

readList :: ReadS [Move x y] #

readPrec :: ReadPrec (Move x y) #

readListPrec :: ReadPrec [Move x y] #

(Show x, Show y) => Show (Move x y) Source # 

Methods

showsPrec :: Int -> Move x y -> ShowS #

show :: Move x y -> String #

showList :: [Move x y] -> ShowS #

(NFData x, NFData y) => NFData (Move x y) Source # 

Methods

rnf :: Move x y -> () #

Opposable (Move x y) Source # 

Methods

getOpposite :: Move x y -> Move x y Source #

(Enum x, Enum y) => Orientated (Move x y) Source # 
Enum x => ReflectableOnY (Move x y) Source # 

Methods

reflectOnY :: Move x y -> Move x y Source #

Enum y => ReflectableOnX (Move x y) Source # 

Methods

reflectOnX :: Move x y -> Move x y Source #

Constants

tag :: String Source #

Used to qualify XML.

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 a Pawn which moved & that the move is valid.