bishbosh-0.0.0.3: Plays chess.

Safe HaskellNone
LanguageHaskell2010

BishBosh.ContextualNotation.PositionHashQualifiedMoveTree

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Facilitates matching of the current position with a tree built from standard openings.

Synopsis

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 positions, return the subsequent qualifiedMove.
  • By matching the position rather than the precise sequence of moves, 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 #

Arguments

:: (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 #

Arguments

:: (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 positions in the tree, & supply the names of those archived games from which it originated.

Constructors

fromQualifiedMoveForest Source #

Arguments

:: (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.