bishbosh-0.0.0.3: Plays chess.

BishBosh.State.CoordinatesByRankByLogicalColour

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION

Synopsis

# Types

## Type-synonyms

The number of pieces in each file, for each logical colour.

A list of coordinates for each logical colour.

## Data-types

• This structure allows one to determine the set of coordinates where a type of piece is located.
• CAVEAT: the list of coordinates is unordered, so test for equality using  deconstruct . sortCoordinates .

Instances

 (Enum x, Enum y, Ord x, Ord y) => Hashable2D CoordinatesByRankByLogicalColour x y Source # MethodslistRandoms2D :: CoordinatesByRankByLogicalColour x y -> Zobrist x y positionHash -> [positionHash] Source # (NFData x, NFData y) => NFData (CoordinatesByRankByLogicalColour x y) Source # Methodsrnf :: CoordinatesByRankByLogicalColour x y -> () # (Enum x, Enum y) => Censor (CoordinatesByRankByLogicalColour x y) Source #

# Functions

• Counts the number of Pawns of each logical colour with similar x-coordinates; their y-coordinate is irrelevant.
• N.B.: files lacking any Pawn, don't feature in the results.

For each logical colour, find the coordinates of any passed Pawns (https://en.wikipedia.org/wiki/Passed_pawn).

Arguments

 :: (Piece -> Bool) Predicate. -> CoordinatesByRankByLogicalColour x y -> [LocatedPiece x y]

Locates those pieces which satisfy the specified predicate.

Arguments

 :: LogicalColour The logical colour of the pieces to find. -> CoordinatesByRankByLogicalColour x y -> [LocatedPiece x y]

Locate all pieces of the specified logical colour.

Arguments

 :: (Enum x, Enum y, Ord x, Ord y) => LogicalColour The logical colour of the Knight for which to search. -> Coordinates x y The destination to which the Knight is required to be capable of jumping. -> CoordinatesByRankByLogicalColour x y -> [Coordinates x y]
• Find any Knights of the specified logical colour, in attack-range around the specified coordinates.
• CAVEAT: nothing is said about whether any piece at the specified coordinates belongs to the opponent, as one might expect.

sumPieceSquareValueByLogicalColour :: Num pieceSquareValue => FindPieceSquareValue x y pieceSquareValue -> CoordinatesByRankByLogicalColour x y -> [pieceSquareValue] Source #

Calculate the total value of the coordinates occupied by the pieces of either side.

assocs :: CoordinatesByRankByLogicalColour x y -> [(Piece, [Coordinates x y])] Source #

Build an association-list.

## Accessors

Arguments

 :: LogicalColour The logical colour of the King to find. -> CoordinatesByRankByLogicalColour x y -> Coordinates x y

Get the coordinates of the King of the specified logical colour.

Dereference the array.

elems :: CoordinatesByRankByLogicalColour x y -> [Coordinates x y] Source #

Access the coordinate-lists.

Constructor.

## Mutators

Arguments

 :: (Eq x, Eq y) => Move x y -> Piece The piece which moved. -> Maybe Rank The (possibly promoted) rank to place at the destination. -> Either (Coordinates x y) (Maybe Rank) Either the destination of any passed Pawn, or the rank of any piece taken. -> Transformation x y

Adjust the array to reflect a new move.

sortCoordinates :: (Ord x, Ord y) => Transformation x y Source #

Independently sort each list of coordinates.