bishbosh-0.1.2.0: Plays chess.
Safe HaskellNone
LanguageHaskell2010

BishBosh.Attribute.MoveType

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Categorises moves, & provides ancillary information as required.
Synopsis

Types

Type-synonyms

Data-types

data MoveType Source #

The sum-type of distinct types of move.

Constructors

Castle IsShort

Castling between the King & one of its Rooks.

EnPassant

Capture by a Pawn of a Pawn as it advanced two squares.

Instances

Instances details
Eq MoveType Source # 
Instance details

Defined in BishBosh.Attribute.MoveType

Read MoveType Source # 
Instance details

Defined in BishBosh.Attribute.MoveType

Show MoveType Source # 
Instance details

Defined in BishBosh.Attribute.MoveType

Default MoveType Source # 
Instance details

Defined in BishBosh.Attribute.MoveType

Methods

def :: MoveType #

NFData MoveType Source # 
Instance details

Defined in BishBosh.Attribute.MoveType

Methods

rnf :: MoveType -> () #

FixedMembership MoveType Source # 
Instance details

Defined in BishBosh.Attribute.MoveType

Methods

members :: [MoveType] Source #

Promotable MoveType Source # 
Instance details

Defined in BishBosh.Attribute.MoveType

Constants

tag :: String Source #

Used to qualify output.

shortCastle :: MoveType Source #

Constant value required to denote a short castle.

longCastle :: MoveType Source #

Constant value required to denote a long castle.

Functions

nPiecesMutator :: Enum nPieces => MoveType -> nPieces -> nPieces Source #

Returns the mutator required to adjust the number of pieces after a move.

Constructors

mkMaybeNormalMoveType Source #

Arguments

:: Maybe Rank

The rank of any opposing piece which was just taken.

-> Maybe Rank

The rank to which a Pawn was just promoted.

-> Maybe MoveType

Maybe the required move-type.

Smart constructor for normal move-types.

mkNormalMoveType Source #

Arguments

:: Maybe Rank

The rank of any opposing piece which is to be taken.

-> Maybe Rank

The rank to which a Pawn is to be promoted.

-> MoveType 

Smart-constructor for normal move-types.

Predicates

isCastle :: MoveType -> Bool Source #

Predicate.

isEnPassant :: MoveType -> Bool Source #

Predicate.

isCapture :: MoveType -> Bool Source #

Whether a piece was captured, including Pawns taken En-passant.

isPromotion :: MoveType -> Bool Source #

Whether the move includes Pawn-promotion.

isSimple :: MoveType -> Bool Source #

The simplest type of move.

isAcyclic :: MoveType -> Bool Source #

  • Whether the move can't be a member of a repeated cycle.
  • CAVEAT: one can't infer from a negative result that the move can be repeated, since the mover may have been a Pawn.

Query

getMaybeExplicitlyTakenRank :: MoveType -> Maybe Rank Source #

Query whether a piece was explicitly taken, excluding Pawns taken En-passant.

getMaybeImplicitlyTakenRank :: MoveType -> Maybe Rank Source #

Query whether a piece was taken either explicitly, or implicitly during En-passant.