Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- The abscissae of those
Rook
s, for the player of each logicalColour, which can still participate in castling.
Synopsis
- type TurnsByLogicalColour = TurnsByLogicalColour Turn
- data CastleableRooksByLogicalColour
- locateForLogicalColour :: LogicalColour -> CastleableRooksByLogicalColour -> Maybe [X]
- fromAssocs :: AbscissaeByLogicalColour -> CastleableRooksByLogicalColour
- fromBoard :: Board -> CastleableRooksByLogicalColour
- fromTurnsByLogicalColour :: TurnsByLogicalColour -> CastleableRooksByLogicalColour
- listIncrementalRandoms :: CastleableRooksByLogicalColour -> CastleableRooksByLogicalColour -> Zobrist random -> [random]
- unify :: Transformation
- takeTurn :: LogicalColour -> Turn -> Transformation
- hasCastled :: LogicalColour -> CastleableRooksByLogicalColour -> Bool
- canCastle :: LogicalColour -> CastleableRooksByLogicalColour -> Bool
- canCastleWith :: LogicalColour -> Coordinates -> CastleableRooksByLogicalColour -> Bool
- cantConverge :: CastleableRooksByLogicalColour -> CastleableRooksByLogicalColour -> Bool
Types
Type-synonyms
type TurnsByLogicalColour = TurnsByLogicalColour Turn Source #
Narrow the type, so the turn can be queried.
Data-types
data CastleableRooksByLogicalColour Source #
For the players of each logical colour, identifies the abscissae of those Rook
s which can still participate in castling (when other constraints are removed).
Instances
Functions
locateForLogicalColour :: LogicalColour -> CastleableRooksByLogicalColour -> Maybe [X] Source #
Find the abscissae of all Rook
s of the specified logical colour, which can still participate in castling.
Constructors
fromAssocs :: AbscissaeByLogicalColour -> CastleableRooksByLogicalColour Source #
Smart constructor.
fromBoard :: Board -> CastleableRooksByLogicalColour Source #
- Smart constructor.
- CAVEAT: doesn't know the move-history, so the wrong answer is possible.
fromTurnsByLogicalColour :: TurnsByLogicalColour -> CastleableRooksByLogicalColour Source #
Constructor.
listIncrementalRandoms Source #
:: CastleableRooksByLogicalColour | The old value. |
-> CastleableRooksByLogicalColour | The new value. |
-> Zobrist random | |
-> [random] |
Generate the additional random-numbers required to correct the hash resulting from a change to the castleable Rook
s.
Mutators
unify :: Transformation Source #
Relinquish the ability to disambiguate between "have Castled" (& therefore can't subsequently), & "Have lost the option to castle".
:: LogicalColour | Defines the side who took the specified turn. |
-> Turn | |
-> Transformation |
Update with the latest turn.
Predicates
hasCastled :: LogicalColour -> CastleableRooksByLogicalColour -> Bool Source #
Predicate.
canCastle :: LogicalColour -> CastleableRooksByLogicalColour -> Bool Source #
Predicate.
:: LogicalColour | |
-> Coordinates |
|
-> CastleableRooksByLogicalColour | |
-> Bool |
Predicate.
cantConverge :: CastleableRooksByLogicalColour -> CastleableRooksByLogicalColour -> Bool Source #
- Determines whether two positions can't converge on each other.
- N.B.: in this function, the two positions are considered to be peers; nothing is assumed regarding which must do the convergence, perhaps both.
- From the initial board, one may converge onto any other position, but any of a set of irreversible changes may compromise this;
the total number of pieces & specifically
Pawn
s, of each logical colour, can't increase;Pawn
s can only advance; the difference in the ranks of all pieces of each logical colour, which can only be reduced through promotion of aPawn
; castling can't be undone. This function only assesses this final change. - CAVEAT: since the potential of one position to converge on another, depends on a wider set of criteria, this function can only be definitive regarding when convergence is impossible, rather than when is possible.
- CAVEAT: this function depends on one side having lost the right to castle, when the other side already has; this is quite rare.