Safe Haskell | None |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
Builds a rose-tree from a PGN Database, each node of which contains a move qualified by a move-type, & possibly also the ultimate result & the game's identifier.
Synopsis
- type Name = String
- type OnymousResult = (Name, Result)
- data QualifiedMoveForest
- showsNames :: Maybe NGames -> [Name] -> ShowS
- findMinimumPieces :: QualifiedMoveForest -> NPieces
- count :: QualifiedMoveForest -> (NGames, NPositions)
- fromPGNDatabase :: PGNDatabase -> QualifiedMoveForest
- toGameTree :: QualifiedMoveForest -> GameTree
- mergePGNDatabase :: PGNDatabase -> QualifiedMoveForest -> QualifiedMoveForest
Types
Type-synonyms
type OnymousResult = (Name, Result) Source #
The name of a game, & it's result.
Data-types
data QualifiedMoveForest Source #
- A representation of a PGN-database, where initial moves shared between games are merged into the trunk of a tree from which they each branch.
- Many games will share standard opening moves, & a tree-structure (cf. a list) uses this to increase space-time efficiency.
- Since there are many different initial moves, the structure is a flat-topped forest rather than a single apex tree.
Instances
Functions
Shows an optional capped list of the names of archived games.
findMinimumPieces :: QualifiedMoveForest -> NPieces Source #
- Find the minimum total number of pieces in any of the recorded games, in order to determining whether a sample game is too small to converge on anything in the tree.
- CAVEAT: no attempt is made to partition this total by logical colour, because there's no clear concept of the minimum amongst the pairs discovered at each leaf-node.
- N.B.: one call also measure other monotonically changing quantities (number of Pawns, number of Castleable Rooks, least advanced Pawn), but this is cheap.
count :: QualifiedMoveForest -> (NGames, NPositions) Source #
Count the number of games & distinct positions.
Constructors
fromPGNDatabase :: PGNDatabase -> QualifiedMoveForest Source #
Constructor.
toGameTree :: QualifiedMoveForest -> GameTree Source #
- Convert the specified qualified-move forest to a game-tree.
- N.B.: to construct a tree from the specified forest, the default initial game is included at the apex.
Mutators
mergePGNDatabase :: PGNDatabase -> QualifiedMoveForest -> QualifiedMoveForest Source #
Include the specified PGN-database into the forest, thus allowing more than one PGNDatabase
to be read.