Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- https://www.chessprogramming.org/Zobrist_Hashing.
- Defines the random-numbers required to construct a hash of a chess-position.
- Facilitates the construction of a hash from arbitrary data.
Synopsis
- class Hashable1D hashable x where
- listRandoms1D :: hashable x -> Zobrist x y positionHash -> [positionHash]
- class Hashable2D hashable x y where
- listRandoms2D :: hashable x y -> Zobrist x y positionHash -> [positionHash]
- data Zobrist x y positionHash
- dereferenceRandomByCoordinatesByRankByLogicalColour :: (Enum x, Enum y, Ord x, Ord y) => LogicalColour -> Rank -> Coordinates x y -> Zobrist x y positionHash -> positionHash
- dereferenceRandomByCastleableRooksXByLogicalColour :: Eq x => LogicalColour -> x -> Zobrist x y positionHash -> Maybe positionHash
- dereferenceRandomByEnPassantAbscissa :: Ix x => x -> Zobrist x y positionHash -> positionHash
- hash2D :: (Bits positionHash, Hashable2D hashable x y) => hashable x y -> Zobrist x y positionHash -> positionHash
- combine :: Bits positionHash => positionHash -> [positionHash] -> positionHash
- mkZobrist :: (Ix x, FiniteBits positionHash, Enum x, Enum y, Num positionHash, Ord y, RandomGen randomGen, Random positionHash) => Maybe Int -> randomGen -> Zobrist x y positionHash
Type-classes
class Hashable1D hashable x where Source #
An interface to which 1-D hashable data can conform.
listRandoms1D :: hashable x -> Zobrist x y positionHash -> [positionHash] Source #
Instances
Ix x => Hashable1D EnPassantAbscissa x Source # | |
Defined in BishBosh.State.EnPassantAbscissa listRandoms1D :: EnPassantAbscissa x -> Zobrist x y positionHash -> [positionHash] Source # | |
Eq x => Hashable1D CastleableRooksByLogicalColour x Source # | Get the list of random numbers required to represent the current castling potential. |
Defined in BishBosh.State.CastleableRooksByLogicalColour listRandoms1D :: CastleableRooksByLogicalColour x -> Zobrist x y positionHash -> [positionHash] Source # |
class Hashable2D hashable x y where Source #
An interface to which 2-D hashable data can conform.
listRandoms2D :: hashable x y -> Zobrist x y positionHash -> [positionHash] Source #
Instances
Types
Data-types
data Zobrist x y positionHash Source #
The random numbers used to generate a hash, which almost uniquely represent a position.
Instances
Foldable (Zobrist x y) Source # | |
Defined in BishBosh.Component.Zobrist fold :: Monoid m => Zobrist x y m -> m # foldMap :: Monoid m => (a -> m) -> Zobrist x y a -> m # foldMap' :: Monoid m => (a -> m) -> Zobrist x y a -> m # foldr :: (a -> b -> b) -> b -> Zobrist x y a -> b # foldr' :: (a -> b -> b) -> b -> Zobrist x y a -> b # foldl :: (b -> a -> b) -> b -> Zobrist x y a -> b # foldl' :: (b -> a -> b) -> b -> Zobrist x y a -> b # foldr1 :: (a -> a -> a) -> Zobrist x y a -> a # foldl1 :: (a -> a -> a) -> Zobrist x y a -> a # toList :: Zobrist x y a -> [a] # null :: Zobrist x y a -> Bool # length :: Zobrist x y a -> Int # elem :: Eq a => a -> Zobrist x y a -> Bool # maximum :: Ord a => Zobrist x y a -> a # minimum :: Ord a => Zobrist x y a -> a # | |
(Enum x, Enum y, Ord y, Show positionHash, Show x, Show y, Ix x) => Show (Zobrist x y positionHash) Source # | |
(Ix x, FiniteBits positionHash, Enum x, Enum y, Num positionHash, Ord y, Random positionHash) => Default (Zobrist x y positionHash) Source # | |
Defined in BishBosh.Component.Zobrist |
Constants
Functions
dereferenceRandomByCoordinatesByRankByLogicalColour :: (Enum x, Enum y, Ord x, Ord y) => LogicalColour -> Rank -> Coordinates x y -> Zobrist x y positionHash -> positionHash Source #
Dereference getRandomByCoordinatesByRankByLogicalColour
.
dereferenceRandomByCastleableRooksXByLogicalColour :: Eq x => LogicalColour -> x -> Zobrist x y positionHash -> Maybe positionHash Source #
Dereference getRandomByCastleableRooksXByLogicalColour
.
dereferenceRandomByEnPassantAbscissa :: Ix x => x -> Zobrist x y positionHash -> positionHash Source #
Dereference getRandomByEnPassantAbscissa
.
hash2D :: (Bits positionHash, Hashable2D hashable x y) => hashable x y -> Zobrist x y positionHash -> positionHash Source #
Resolve a hashable into a hash.
combine :: Bits positionHash => positionHash -> [positionHash] -> positionHash Source #
Include a list of random numbers in the hash.