Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Categorises moves, & provides ancillary information as required.
- data MoveType
- tag :: String
- shortCastle :: MoveType
- longCastle :: MoveType
- enPassant :: MoveType
- nPiecesMutator :: Enum nPieces => MoveType -> nPieces -> nPieces
- mkMaybeNormalMoveType :: Maybe Rank -> Maybe Rank -> Maybe MoveType
- mkNormalMoveType :: Maybe Rank -> Maybe Rank -> MoveType
- isCastle :: MoveType -> Bool
- isEnPassant :: MoveType -> Bool
- isCapture :: MoveType -> Bool
- isPromotion :: MoveType -> Bool
- isQuiet :: MoveType -> Bool
- isAcyclic :: MoveType -> Bool
- getMaybeExplicitlyTakenRank :: MoveType -> Maybe Rank
- getMaybeImplicitlyTakenRank :: MoveType -> Maybe Rank
Types
Type-synonyms
Data-types
Classifies the distinct types of move.
Constants
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 #
:: Maybe Rank | The rank of any opposing piece which was just taken. |
-> Maybe Rank | The rank to which a |
-> Maybe MoveType | Maybe the required move-type. |
Smart-constructor for normal move-types.
:: Maybe Rank | The rank of any opposing piece which is to be taken. |
-> Maybe Rank | The rank to which a |
-> MoveType |
Smart-constructor for normal move-types.
Predicates
isEnPassant :: MoveType -> Bool Source #
Predicate.
isCapture :: MoveType -> Bool Source #
Whether a piece was captured, including Pawn
s taken En-passant.
isPromotion :: MoveType -> Bool Source #
Whether the move includes Pawn
-promotion.
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
.