bishbosh-0.1.4.0: Plays chess.
Safe HaskellNone
LanguageHaskell2010

BishBosh.State.InstancesByPosition

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Records the number of times each position has been encountered since the last unrepeatable move.
Synopsis

Types

Type-synonyms

Constants

leastCyclicPlies :: NPlies Source #

The smallest number of repeatable plies (applied by alternating players) required to form a cycle.

Data-types

data InstancesByPosition position Source #

Wrap the type, so that class-instances can be hung from it.

Instances

Instances details
Eq position => Eq (InstancesByPosition position) Source # 
Instance details

Defined in BishBosh.State.InstancesByPosition

Methods

(==) :: InstancesByPosition position -> InstancesByPosition position -> Bool #

(/=) :: InstancesByPosition position -> InstancesByPosition position -> Bool #

NFData position => NFData (InstancesByPosition position) Source # 
Instance details

Defined in BishBosh.State.InstancesByPosition

Methods

rnf :: InstancesByPosition position -> () #

(Ord position, ReflectableOnX position) => ReflectableOnX (InstancesByPosition position) Source # 
Instance details

Defined in BishBosh.State.InstancesByPosition

Functions

countConsecutiveRepeatablePlies :: InstancesByPosition position -> NPlies Source #

  • Count the total number of consecutive repeatable plies amongst recent moves.
  • This is equivalent to the number of entries in the map, since adding a non-repeatable move triggers a purge.

countPositionRepetitions :: InstancesByPosition position -> NPositions Source #

Count the total number of repetitions of positions.

getNDistinctPositions :: InstancesByPosition position -> NPositions Source #

The number of distinct positions.

findMaximumInstances :: InstancesByPosition position -> NPositions Source #

  • Find the maximum number of times any one position has already been visited.
  • CAVEAT: only those positions that can still be reached are considered.

Constructors

mkInstancesByPosition Source #

Arguments

:: (Foldable foldable, Ord position) 
=> (a -> position)

Position-constructor.

-> foldable a

Data from which to construct positions.

-> InstancesByPosition position 

Construct from repeatable data.

mkSingleton :: position -> InstancesByPosition position Source #

Constructor.

Mutators

insertPosition Source #

Arguments

:: Ord position 
=> Bool

Whether the turn which led to the specified position, was repeatable.

-> position 
-> Transformation position 

Insert a position into the collection.

deletePosition :: Ord position => position -> Transformation position Source #

Remove a position from the collection, as required to implement rollback.

Predicates

anyInstancesByPosition :: (NPositions -> Bool) -> InstancesByPosition position -> Bool Source #

Predicate: apply the specified predicate to the map.