bishbosh-0.1.0.0: Plays chess.
Safe HaskellNone
LanguageHaskell2010

BishBosh.State.CoordinatesByRankByLogicalColour

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Synopsis

Types

Type-synonyms

type NPiecesByFileByLogicalColour x = ArrayByLogicalColour (Map x NPieces) Source #

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

type CoordinatesByLogicalColour x y = ArrayByLogicalColour [Coordinates x y] Source #

A list of coordinates for each logical colour.

Data-types

data CoordinatesByRankByLogicalColour x y Source #

  • 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

Instances details
(Enum x, Enum y, Ord x, Ord y) => Hashable2D CoordinatesByRankByLogicalColour x y Source # 
Instance details

Defined in BishBosh.State.CoordinatesByRankByLogicalColour

Methods

listRandoms2D :: CoordinatesByRankByLogicalColour x y -> Zobrist x y positionHash -> [positionHash] Source #

(Enum x, Enum y, Ord x, Ord y) => Seeker CoordinatesByRankByLogicalColour x y Source #
  • 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.
Instance details

Defined in BishBosh.State.CoordinatesByRankByLogicalColour

(NFData x, NFData y) => NFData (CoordinatesByRankByLogicalColour x y) Source # 
Instance details

Defined in BishBosh.State.CoordinatesByRankByLogicalColour

(Enum x, Enum y) => Censor (CoordinatesByRankByLogicalColour x y) Source # 
Instance details

Defined in BishBosh.State.CoordinatesByRankByLogicalColour

Functions

countPawnsByFileByLogicalColour :: Ord x => CoordinatesByRankByLogicalColour x y -> NPiecesByFileByLogicalColour x Source #

  • 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.

findPiecesOfColour Source #

Arguments

:: LogicalColour

The logical colour of the pieces to find.

-> CoordinatesByRankByLogicalColour x y 
-> [LocatedPiece x y] 

Locate all pieces of the specified logical colour.

sumPieceSquareValueByLogicalColour :: Num pieceSquareValue => FindPieceSquareValues 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.

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

Access the coordinate-lists.

Accessors

getKingsCoordinates Source #

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.

Constructor

Mutators

movePiece Source #

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.