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`

, '(==)', ...

- 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`

.

# Function

countGames :: Depth -> NGames Source #

- Counts the number of
*game-state*s in the constant game of chess, at the specified depth, including any which terminated earlier. - N.B.: some of the
*game-state*s may have identical positions, reached by different sequences of*move*s.

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.