module BishBosh.StateProperty.Hashable(
Hashable(..),
hash,
combine
) where
import qualified BishBosh.Component.Zobrist as Component.Zobrist
import qualified Data.Bits
import qualified Data.List
class Hashable hashable where
listRandoms :: hashable -> Component.Zobrist.Zobrist positionHash -> [positionHash]
combiningOp :: Data.Bits.Bits positionHash => positionHash -> positionHash -> positionHash
combiningOp :: positionHash -> positionHash -> positionHash
combiningOp = positionHash -> positionHash -> positionHash
forall a. Bits a => a -> a -> a
Data.Bits.xor
hash :: (
Data.Bits.Bits positionHash,
Hashable hashable
)
=> hashable
-> Component.Zobrist.Zobrist positionHash
-> positionHash
hash :: hashable -> Zobrist positionHash -> positionHash
hash hashable
hashable = (positionHash -> positionHash -> positionHash)
-> [positionHash] -> positionHash
forall a. (a -> a -> a) -> [a] -> a
Data.List.foldl1' positionHash -> positionHash -> positionHash
forall a. Bits a => a -> a -> a
combiningOp ([positionHash] -> positionHash)
-> (Zobrist positionHash -> [positionHash])
-> Zobrist positionHash
-> positionHash
forall b c a. (b -> c) -> (a -> b) -> a -> c
. hashable -> Zobrist positionHash -> [positionHash]
forall hashable positionHash.
Hashable hashable =>
hashable -> Zobrist positionHash -> [positionHash]
listRandoms hashable
hashable
combine :: Data.Bits.Bits positionHash => positionHash -> [positionHash] -> positionHash
combine :: positionHash -> [positionHash] -> positionHash
combine = (positionHash -> positionHash -> positionHash)
-> positionHash -> [positionHash] -> positionHash
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
Data.List.foldl' positionHash -> positionHash -> positionHash
forall a. Bits a => a -> a -> a
combiningOp