Safe Haskell | None |
---|---|

Language | Haskell2010 |

`AUTHOR`

- Dr. Alistair Ward
`DESCRIPTION`

- Facilitates matching of the current
*position*with a tree built from standard openings.

- type OnymousQualifiedMove x y = (QualifiedMove x y, [OnymousResult])
- data NodeLabel x y positionHash
- data PositionHashQualifiedMoveTree x y positionHash
- findNextOnymousQualifiedMovesForPosition :: (Ix x, Bits positionHash, Enum x, Enum y, Ord y) => FindMatch x y positionHash
- findNextOnymousQualifiedMoves :: (Ix x, Bits positionHash, NFData x, NFData y, Enum x, Enum y, Ord y, Show x, Show y) => (Bool, Bool, Bool) -> FindMatch x y positionHash
- maybeRandomlySelectOnymousQualifiedMove :: (NFData x, NFData y, Ix x, Bits positionHash, Enum x, Enum y, Ord y, Show x, Show y, RandomGen randomGen) => randomGen -> (Bool, Bool, Bool) -> Game x y -> PositionHashQualifiedMoveTree x y positionHash -> Maybe (QualifiedMove x y, [Name])
- fromQualifiedMoveForest :: (Ix x, Bits positionHash, Enum x, Enum y, Ord y, Show x, Show y) => Bool -> Zobrist x y positionHash -> QualifiedMoveForest x y -> PositionHashQualifiedMoveTree x y positionHash
- isTerminal :: PositionHashQualifiedMoveTree x y positionHash -> Bool

# Types

## Type-synonyms

type OnymousQualifiedMove x y = (QualifiedMove x y, [OnymousResult]) Source #

A *qualified move* annotated by the name & ultimate *result*, of each *game* from which it could have originated.

## Data-types

data NodeLabel x y 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 x y positionHash Source #

Constructor.

# Functions

findNextOnymousQualifiedMovesForPosition :: (Ix x, Bits positionHash, Enum x, Enum y, Ord y) => FindMatch x y positionHash Source #

- For all matching
*position*s, return the subsequent*qualifiedMove*. - By matching the
*position*rather than the precise sequence of*move*s, transpositions https://chessprogramming.wikispaces.com/Transposition can also be identified. - CAVEAT: a null list can result from either match-failure, or a match with the final
*move*of a*game*.

findNextOnymousQualifiedMoves Source #

:: (Ix x, Bits positionHash, NFData x, NFData y, Enum x, Enum y, Ord y, Show x, Show y) | |

=> (Bool, Bool, Bool) | MatchSwitches. |

-> FindMatch x y positionHash |

- 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 Source #

:: (NFData x, NFData y, Ix x, Bits positionHash, Enum x, Enum y, Ord y, Show x, Show y, RandomGen randomGen) | |

=> randomGen | |

-> (Bool, Bool, Bool) | MatchSwitches. |

-> Game x y | |

-> PositionHashQualifiedMoveTree x y positionHash | |

-> Maybe (QualifiedMove x y, [Name]) |

Randomly select a *qualifiedMove* from matching *position*s in the tree, & supply the names of those archived games from which it originated.

## Constructors

fromQualifiedMoveForest Source #

:: (Ix x, Bits positionHash, Enum x, Enum y, Ord y, Show x, Show y) | |

=> Bool | IncrementalEvaluation. |

-> Zobrist x y positionHash | |

-> QualifiedMoveForest x y | |

-> PositionHashQualifiedMoveTree x y 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 x y positionHash -> Bool Source #

Predicate.