Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- The relative values of the various ranks of chess-piece.
- https://en.wikipedia.org/wiki/Chess_piece_relative_value#Hans_Berliner.27s_system%20Chess-piece%20relative%20values
Synopsis
- data RankValues rankValue
- tag :: String
- findRankValue :: Rank -> RankValues rankValue -> rankValue
- calculateMaximumTotalValue :: Num rankValue => RankValues rankValue -> rankValue
- fromAssocs :: (Fractional rankValue, Ord rankValue, Show rankValue) => [(Rank, rankValue)] -> RankValues rankValue
Types
Data-types
data RankValues rankValue Source #
- The constant value associated with each rank; the higher, the more valuable it is considered to be.
- N.B.: only relative values are significant; the absolute value associated with any rank is irrelevant, but typically
Pawn = 1
. - CAVEAT: a
King
can never be taken, but assigning the value infinity creates problems, so typically it has the value0
.
Instances
Constants
Functions
findRankValue :: Rank -> RankValues rankValue -> rankValue Source #
Query.
calculateMaximumTotalValue :: Num rankValue => RankValues rankValue -> rankValue Source #
- The maximum total rank-value one side can have.
- CAVEAT: assumes that zero pieces have been captured, all
Pawn
s have been queened, & that this is the most valuable rank of piece.
Constructor
fromAssocs :: (Fractional rankValue, Ord rankValue, Show rankValue) => [(Rank, rankValue)] -> RankValues rankValue Source #
Smart-constructor.