| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
BishBosh.Model.MoveFrequency
Description
AUTHOR- Dr. Alistair Ward
DESCRIPTION
- The instances of various moves, categorised by logical colour & rank, are recorded from a large resource of games.
- The frequency-distribution can then be used to sort the moves in the current game, to prioritise evaluation of likely candidates.
- type GetRankAndMove a move = a -> (Rank, move)
- data MoveFrequency move
- countEntries :: MoveFrequency move -> NMoves
- insertMoves :: Ord move => LogicalColour -> GetRankAndMove a move -> MoveFrequency move -> [a] -> MoveFrequency move
- sortByDescendingMoveFrequency :: Ord move => LogicalColour -> GetRankAndMove a move -> MoveFrequency move -> [a] -> [a]
Types
Type-synonyms
type GetRankAndMove a move = a -> (Rank, move) Source #
The type of a function which can extract the rank & move from a datum.
Data-types
data MoveFrequency move Source #
The number of recorded instances of each move.
Instances
| Eq move => Eq (MoveFrequency move) Source # | |
| Empty (MoveFrequency move) Source # | |
| Null (MoveFrequency move) Source # | |
Functions
countEntries :: MoveFrequency move -> NMoves Source #
Count the total number of entries.
Arguments
| :: Ord move | |
| => LogicalColour | References the player who is required to make any one of the specified moves. |
| -> GetRankAndMove a move | How to extract the required rank & move from a datum. |
| -> MoveFrequency move | |
| -> [a] | The data from each of which, rank & move can be extracted. |
| -> MoveFrequency move |
- Inserts a list of data from which rank & move can be extracted, each of which were made by pieces of the same logical colour, i.e. by the same player.
- If the entry already exists, then the count for that rank & move, is increased.
sortByDescendingMoveFrequency Source #
Arguments
| :: Ord move | |
| => LogicalColour | References the player who is required to make any one of the specified moves. |
| -> GetRankAndMove a move | How to extract the required rank & move from a datum. |
| -> MoveFrequency move | |
| -> [a] | The data from each of which, rank & move can be extracted. |
| -> [a] |
- Sorts an arbitrary list on the recorded frequency of the rank & move accessible from each list-item.
- The rank & move extracted from each list-item, is assumed to have been made by the player of the specified logical colour.