Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Facilitates matching of the current position in a tree built from standard openings.
Synopsis
- type TryToMatchMoves = Bool
- type TryToMatchViaJoiningMove = Bool
- type TryToMatchColourFlippedPosition = Bool
- type PreferVictories = Bool
- type MatchSwitches = (TryToMatchMoves, TryToMatchViaJoiningMove, TryToMatchColourFlippedPosition)
- data NodeLabel positionHash
- data PositionHashQualifiedMoveTree positionHash
- findNextOnymousQualifiedMovesForPosition :: Bits positionHash => FindMatch positionHash
- findNextOnymousQualifiedMoves :: Bits positionHash => MatchSwitches -> FindMatch positionHash
- maybeRandomlySelectOnymousQualifiedMove :: (Bits positionHash, RandomGen randomGen) => randomGen -> PreferVictories -> MatchSwitches -> Game -> PositionHashQualifiedMoveTree positionHash -> Maybe (QualifiedMove, [Name])
- fromQualifiedMoveForest :: Bits positionHash => Bool -> Zobrist positionHash -> QualifiedMoveForest -> PositionHashQualifiedMoveTree positionHash
- isTerminal :: PositionHashQualifiedMoveTree positionHash -> Bool
Types
Type-synonyms
type TryToMatchMoves = Bool Source #
Whether to attempt to exactly match moves with a standard opening; transpositions won't be matched.
type TryToMatchViaJoiningMove = Bool Source #
Whether to attempt to join the current position to a standard opening that's only one ply away.
type TryToMatchColourFlippedPosition = Bool Source #
Whether to attempt to match a colour-flipped version of the current position with a standard opening
type PreferVictories = Bool Source #
Whether from all matching positions extracted from the tree, to prefer moves which result in a greater probability of victory, for the player who has the next move.
type MatchSwitches = (TryToMatchMoves, TryToMatchViaJoiningMove, TryToMatchColourFlippedPosition) Source #
The switches used to control attempts to find a match amongst standard openings.
Data-types
data NodeLabel positionHash Source #
Each label of the tree contains a Zobrist-hash of the current position, augmented (except in the case of the apex-game) by the last move that was played, & any conclusive result.
data PositionHashQualifiedMoveTree positionHash Source #
Constructor.
Functions
findNextOnymousQualifiedMovesForPosition :: Bits positionHash => FindMatch positionHash Source #
- For all matching positions, return the subsequent qualifiedMove.
- By matching the position rather than the precise sequence of moves, transpositions https://www.chessprogramming.org/Transposition can also be identified.
- N.B.: a comparison between the number of pieces in the game we're required to match & the decreasing number of pieces down the tree, permits early termination of the search.
- CAVEAT: a null list can result from either match-failure, or a match with the final move of a game.
findNextOnymousQualifiedMoves :: Bits positionHash => MatchSwitches -> FindMatch positionHash Source #
- Calls
findNextOnymousQualifiedMovesForGame
to find an exact match for the current game in the tree. - Calls
findNextOnymousQualifiedMovesForPosition
to find a match for the current position in the tree. - On failure, it searches the tree to find a match for the colour-flipped position.
- On failure, it searches for any move which can be used to join the position with the tree.
- On failure, it searches for any move which can be used to join the colour-flipped position with the tree.
- CAVEAT: the order of these searches has been hard-coded.
maybeRandomlySelectOnymousQualifiedMove :: (Bits positionHash, RandomGen randomGen) => randomGen -> PreferVictories -> MatchSwitches -> Game -> PositionHashQualifiedMoveTree positionHash -> Maybe (QualifiedMove, [Name]) Source #
Randomly select a qualifiedMove from matching positions in the tree, & supply the names of those archived games from which it originated.
Constructors
fromQualifiedMoveForest Source #
:: Bits positionHash | |
=> Bool | IncrementalEvaluation. |
-> Zobrist positionHash | |
-> QualifiedMoveForest | |
-> PositionHashQualifiedMoveTree positionHash |
Augment the specified qualified-move forest with a Zobrist-hash of the position & include the default initial game at the apex.
Predicates
isTerminal :: PositionHashQualifiedMoveTree positionHash -> Bool Source #
Predicate.