Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Constructs a tree in which each node contains; a Zobrist-hash; a quantifiedGame with one of the moves available to its parent node applied; & an evaluation of the fitness of the resulting position.
- Each forest in the tree is sorted, before evaluation of its fitness is performed.
- CAVEAT: promotions are insufficiently frequent to be treated specially when sorting.
Synopsis
- type Forest x y positionHash = [BarePositionHashQuantifiedGameTree x y positionHash]
- data NodeLabel x y positionHash
- newtype PositionHashQuantifiedGameTree x y positionHash = MkPositionHashQuantifiedGameTree {
- deconstruct :: BarePositionHashQuantifiedGameTree x y positionHash
- reduce :: IsMatch (NodeLabel x y positionHash) -> PositionHashQuantifiedGameTree x y positionHash -> Maybe (PositionHashQuantifiedGameTree x y positionHash)
- traceRoute :: (Turn x y -> IsMatch (NodeLabel x y positionHash)) -> PositionHashQuantifiedGameTree x y positionHash -> [Turn x y] -> Maybe [NodeLabel x y positionHash]
- resign :: PositionHashQuantifiedGameTree x y positionHash -> PositionHashQuantifiedGameTree x y positionHash
- traceMatchingMoves :: (Eq x, Eq y) => PositionHashQuantifiedGameTree x y positionHash -> [QualifiedMove x y] -> Maybe [NodeLabel x y positionHash]
- promoteMatchingMoves :: (Eq x, Eq y) => [QualifiedMove x y] -> Forest x y positionHash -> Maybe (Forest x y positionHash)
- sortNonCaptureMoves :: (Forest x y positionHash -> Forest x y positionHash) -> Forest x y positionHash -> Forest x y positionHash
- getRootQuantifiedGame' :: BarePositionHashQuantifiedGameTree x y positionHash -> QuantifiedGame x y
- getRootPositionHash :: PositionHashQuantifiedGameTree x y positionHash -> positionHash
- getRootQuantifiedGame :: PositionHashQuantifiedGameTree x y positionHash -> QuantifiedGame x y
- fromBarePositionHashQuantifiedGameTree :: BarePositionHashQuantifiedGameTree x y positionHash -> PositionHashQuantifiedGameTree x y positionHash
- mkPositionHashQuantifiedGameTree :: (Ix x, Bits positionHash, Fractional pieceSquareValue, Integral x, Integral y, Real pieceSquareValue, Show x, Show y) => EvaluationOptions pieceSquareValue x y -> SearchOptions -> Zobrist x y positionHash -> MoveFrequency x y -> Game x y -> PositionHashQuantifiedGameTree x y positionHash
Types
Type-synonyms
type Forest x y positionHash = [BarePositionHashQuantifiedGameTree x y positionHash] Source #
Self-documentation.
Data-types
data NodeLabel x y positionHash Source #
Define a node in the tree to contain the hash of a game & an evaluation of the fitness of that game.
Instances
(Enum x, Enum y, Ord x, Ord y, Eq positionHash) => Eq (NodeLabel x y positionHash) Source # | |
(Enum x, Enum y, Ord x, Ord y, Show positionHash, Show x, Show y) => Show (NodeLabel x y positionHash) Source # | |
Null (NodeLabel x y positionHash) Source # | |
(Enum x, Enum y) => ShowNotationFloat (NodeLabel x y positionHash) Source # | |
Defined in BishBosh.Evaluation.PositionHashQuantifiedGameTree showsNotationFloat :: MoveNotation -> (Double -> ShowS) -> NodeLabel x y positionHash -> ShowS Source # |
newtype PositionHashQuantifiedGameTree x y positionHash Source #
Wrap the bare tree.
MkPositionHashQuantifiedGameTree | |
|
Instances
(Enum x, Enum y, Ord x, Ord y, Eq positionHash) => Eq (PositionHashQuantifiedGameTree x y positionHash) Source # | |
Defined in BishBosh.Evaluation.PositionHashQuantifiedGameTree (==) :: PositionHashQuantifiedGameTree x y positionHash -> PositionHashQuantifiedGameTree x y positionHash -> Bool # (/=) :: PositionHashQuantifiedGameTree x y positionHash -> PositionHashQuantifiedGameTree x y positionHash -> Bool # | |
Prunable (PositionHashQuantifiedGameTree x y positionHash) Source # | |
Defined in BishBosh.Evaluation.PositionHashQuantifiedGameTree prune :: Depth -> PositionHashQuantifiedGameTree x y positionHash -> PositionHashQuantifiedGameTree x y positionHash Source # | |
(Enum x, Enum y) => ShowNotationFloat (PositionHashQuantifiedGameTree x y positionHash) Source # | |
Defined in BishBosh.Evaluation.PositionHashQuantifiedGameTree showsNotationFloat :: MoveNotation -> (Double -> ShowS) -> PositionHashQuantifiedGameTree x y positionHash -> ShowS Source # |
Functions
reduce :: IsMatch (NodeLabel x y positionHash) -> PositionHashQuantifiedGameTree x y positionHash -> Maybe (PositionHashQuantifiedGameTree x y positionHash) Source #
Forward request.
traceRoute :: (Turn x y -> IsMatch (NodeLabel x y positionHash)) -> PositionHashQuantifiedGameTree x y positionHash -> [Turn x y] -> Maybe [NodeLabel x y positionHash] Source #
Forward request.
resign :: PositionHashQuantifiedGameTree x y positionHash -> PositionHashQuantifiedGameTree x y positionHash Source #
Amend the apex-game to reflect the resignation of the next player.
:: (Eq x, Eq y) | |
=> PositionHashQuantifiedGameTree x y positionHash | |
-> [QualifiedMove x y] | |
-> Maybe [NodeLabel x y positionHash] | Returns |
Follow the specified move-sequence down the positionHashQuantifiedGameTree.
:: (Eq x, Eq y) | |
=> [QualifiedMove x y] | The list of qualifiedMoves, which should be promoted at successively deeper levels in the tree. |
-> Forest x y positionHash | |
-> Maybe (Forest x y positionHash) | Returns |
- Promotes the first matching move to the head of the forest, then descends & recursively promotes the next matching move in the sub-forest.
- N.B.: this can be used to dynamically re-order the forest when a transposition is detected.
sortNonCaptureMoves :: (Forest x y positionHash -> Forest x y positionHash) -> Forest x y positionHash -> Forest x y positionHash Source #
- Sorts the forest, starting just after any initial capture-moves.
- N.B.: this can be used to dynamically re-order the forest using the killer heuristic.
Accessors
getRootQuantifiedGame' :: BarePositionHashQuantifiedGameTree x y positionHash -> QuantifiedGame x y Source #
Accessor.
getRootPositionHash :: PositionHashQuantifiedGameTree x y positionHash -> positionHash Source #
Accessor.
getRootQuantifiedGame :: PositionHashQuantifiedGameTree x y positionHash -> QuantifiedGame x y Source #
Accessor.
Constructor
fromBarePositionHashQuantifiedGameTree :: BarePositionHashQuantifiedGameTree x y positionHash -> PositionHashQuantifiedGameTree x y positionHash Source #
Constructor.
mkPositionHashQuantifiedGameTree Source #
:: (Ix x, Bits positionHash, Fractional pieceSquareValue, Integral x, Integral y, Real pieceSquareValue, Show x, Show y) | |
=> EvaluationOptions pieceSquareValue x y | |
-> SearchOptions | |
-> Zobrist x y positionHash | |
-> MoveFrequency x y | |
-> Game x y | The current state of the game. |
-> PositionHashQuantifiedGameTree x y positionHash |
Constructor.