License | BSD-3-Clause |
---|---|
Safe Haskell | None |
Language | Haskell2010 |
Swarm.Game.Scenario.Scoring.GenericMetrics
Description
Data types and functions applicable across different scoring methods.
Synopsis
Documentation
This is a subset of the ScenarioStatus type that excludes the NotStarted case.
Instances
FromJSON Progress Source # | |||||
Defined in Swarm.Game.Scenario.Scoring.GenericMetrics | |||||
ToJSON Progress Source # | |||||
Generic Progress Source # | |||||
Defined in Swarm.Game.Scenario.Scoring.GenericMetrics Associated Types
| |||||
Read Progress Source # | |||||
Show Progress Source # | |||||
Eq Progress Source # | |||||
Ord Progress Source # | |||||
Defined in Swarm.Game.Scenario.Scoring.GenericMetrics | |||||
type Rep Progress Source # | |||||
Defined in Swarm.Game.Scenario.Scoring.GenericMetrics |
Instances
metricProgress :: forall a f. Functor f => (Progress -> f Progress) -> Metric a -> f (Metric a) Source #
The player progress, so that we know if this game was completed.
metricData :: forall a f. Functor f => (a -> f a) -> Metric a -> f (Metric a) Source #
Metric data, for example start and end time.
Arguments
:: Ord a | |
=> (b -> Maybe a) | criteria; record field extractor |
-> Metric b | x |
-> Metric b | y |
-> Metric b |
This encodes the notion of "more play is better" for incomplete games (rationale: more play = more fun), whereas "smaller inputs are better" for completed games.
Since Maybe
has its own Ord
instance where
Nothing < Just x
regardless of x
, when we want to
choose the minimum value we fmap Down
to ensure that
the Just
is selected while inverting the ordering of
the inner member.