Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Defines chess as a constant tree of all possible moves.
- Because of the conceptually infinite size of this data-structure, care must be taken not to attempt to call
show
, '(==)', ...
Synopsis
- type MoveFrequency x y = MoveFrequency (Move x y)
- data GameTree x y
- countGames :: Depth -> NGames
- countMoves :: Depth -> NGames
- traceRoute :: (Eq x, Eq y) => GameTree x y -> [Turn x y] -> Maybe [Game x y]
- sortGameTree :: (Integral x, Integral y, Num rankValue, Ord rankValue) => Bool -> Maybe CaptureMoveSortAlgorithm -> EvaluateRank rankValue -> MoveFrequency x y -> Transformation x y
- toMoveFrequency :: (Ord x, Ord y) => GameTree x y -> MoveFrequency x y
- fromBareGameTree :: BareGameTree x y -> GameTree x y
- fromGame :: (Enum x, Enum y, Ord x, Ord y, Show x, Show y) => Game x y -> GameTree x y
Types
Type-synonyms
type MoveFrequency x y = MoveFrequency (Move x y) Source #
Focus the underlying type.
Data-types
Wrap a BareGameTree
.
Instances
(Enum x, Enum y, Ord x, Ord y, Show x, Show y) => Show (GameTree x y) Source # | |
(Enum x, Enum y, Ord x, Ord y, Show x, Show y) => Default (GameTree x y) Source # | |
Defined in BishBosh.Model.GameTree | |
Prunable (GameTree x y) Source # | |
(Enum x, Enum y) => ShowNotation (GameTree x y) Source # | |
Defined in BishBosh.Model.GameTree showsNotation :: MoveNotation -> GameTree x y -> ShowS Source # |
Function
countGames :: Depth -> NGames Source #
- Counts the number of game-states in the constant game of chess, at the specified depth, including any which terminated earlier.
- N.B.: some of the game-states may have identical positions, reached by different sequences of moves.
countMoves :: Depth -> NGames Source #
Counts the number of possible plies in chess, down to the specified depth.
:: (Eq x, Eq y) | |
=> GameTree x y | |
-> [Turn x y] | The data against which, nodes from the tree should be matched. |
-> Maybe [Game x y] | Returns |
Trace the route down the tree which matches the specified list of turns.
:: (Integral x, Integral y, Num rankValue, Ord rankValue) | |
=> Bool | preferMovesTowardsCentre. |
-> Maybe CaptureMoveSortAlgorithm | |
-> EvaluateRank rankValue | |
-> MoveFrequency x y | |
-> Transformation x y |
- Independently sorts the forest of moves at each node of the tree, without regard to runtime-data.
- Depending on preferences, the list of moves available to each game is sequentially sorted by: those which reduce the radius from the centre of the board. either those which capture a valuable piece using a cheap piece, or those which win extended battles at a specific location.
- The above sort-algorithms are stable & can therefore be applied independently.
toMoveFrequency :: (Ord x, Ord y) => GameTree x y -> MoveFrequency x y Source #
- Count the instances of each move in the specified tree, including any pre-applied to the apex game.
- CAVEAT: ambiguity remains regarding the move-type (especially any piece taken).
- CAVEAT: a node is counted as just one instance of the move, rather than the number of games which passed through that node. Had the move-frequency been derived from a list of games, a different distribution would result, but then early moves would appear popular rather than just the consequence of limited choice.
Constructor
fromBareGameTree :: BareGameTree x y -> GameTree x y Source #
Constructor.