Copyright | (c) Alexander Vieth 2015 |
---|---|
License | BSD3 |
Maintainer | aovieth@gmail.com |
Stability | experimental |
Portability | non-portable (GHC only) |
Safe Haskell | None |
Language | Haskell2010 |
Diplomacy.Game
Description
- data Game round roundStatus where
- TypicalGame :: TypicalRound round -> Status roundStatus -> Turn -> Map Zone (Aligned Unit, RoundOrderConstructor roundStatus Typical) -> Control -> Game round roundStatus
- RetreatGame :: RetreatRound round -> Status roundStatus -> Turn -> Resolution Typical -> Map Zone (Aligned Unit, RoundOrderConstructor roundStatus Retreat) -> Occupation -> Control -> Game round roundStatus
- AdjustGame :: AdjustRound round -> Status roundStatus -> Turn -> Map Zone (Aligned Unit, RoundOrderConstructor roundStatus Adjust) -> Control -> Game round roundStatus
- data Round where
- data RoundStatus where
- data Status roundStatus where
- data TypicalRound round where
- data RetreatRound round where
- data AdjustRound round where
- type family NextRound (round :: Round) :: Round where ...
- type family RoundPhase (round :: Round) :: Phase where ...
- type family RoundOrderConstructor (roundStatus :: RoundStatus) :: Phase -> * where ...
- roundToInt :: Round -> Int
- nextRound :: Round -> Round
- prevRound :: Round -> Round
- gameZonedOrders :: Game round RoundUnresolved -> Map Zone (Aligned Unit, SomeOrderObject (RoundPhase round))
- gameZonedResolvedOrders :: Game round RoundResolved -> Map Zone (Aligned Unit, SomeResolved OrderObject (RoundPhase round))
- gameOccupation :: Game round roundStatus -> Occupation
- gameDislodged :: RoundPhase round ~ Retreat => Game round RoundUnresolved -> Map Zone (Aligned Unit)
- gameControl :: Game round roundStatus -> Control
- gameTurn :: Game round roundStatus -> Turn
- gameRound :: Game round roundStatus -> Round
- gameSeason :: Game round roundStatus -> Season
- issueOrders :: forall round. Map Zone (Aligned Unit, SomeOrderObject (RoundPhase round)) -> Game round RoundUnresolved -> (ValidateOrdersOutput (RoundPhase round), Game round RoundUnresolved)
- removeBuildOrders :: RoundPhase round ~ Adjust => Set GreatPower -> Game round RoundUnresolved -> Game round RoundUnresolved
- resolve :: Game round RoundUnresolved -> Game round RoundResolved
- continue :: Game round RoundResolved -> Game (NextRound round) RoundUnresolved
- newGame :: Game RoundOne RoundUnresolved
- showGame :: Game round roundStatus -> String
Documentation
data Game round roundStatus where Source #
Constructors
TypicalGame :: TypicalRound round -> Status roundStatus -> Turn -> Map Zone (Aligned Unit, RoundOrderConstructor roundStatus Typical) -> Control -> Game round roundStatus | |
RetreatGame :: RetreatRound round -> Status roundStatus -> Turn -> Resolution Typical -> Map Zone (Aligned Unit, RoundOrderConstructor roundStatus Retreat) -> Occupation -> Control -> Game round roundStatus | |
AdjustGame :: AdjustRound round -> Status roundStatus -> Turn -> Map Zone (Aligned Unit, RoundOrderConstructor roundStatus Adjust) -> Control -> Game round roundStatus |
data RoundStatus where Source #
Constructors
RoundUnresolved :: RoundStatus | |
RoundResolved :: RoundStatus |
Instances
data Status roundStatus where Source #
Constructors
Unresolved :: Status RoundUnresolved | |
Resolved :: Status RoundResolved |
data TypicalRound round where Source #
Constructors
TypicalRoundOne :: TypicalRound RoundOne | |
TypicalRoundTwo :: TypicalRound RoundThree |
Instances
Show (TypicalRound round) Source # | |
data RetreatRound round where Source #
Constructors
RetreatRoundOne :: RetreatRound RoundTwo | |
RetreatRoundTwo :: RetreatRound RoundFour |
Instances
Show (RetreatRound round) Source # | |
data AdjustRound round where Source #
Constructors
AdjustRound :: AdjustRound RoundFive |
Instances
Show (AdjustRound round) Source # | |
type family RoundPhase (round :: Round) :: Phase where ... Source #
Equations
RoundPhase RoundOne = Typical | |
RoundPhase RoundTwo = Retreat | |
RoundPhase RoundThree = Typical | |
RoundPhase RoundFour = Retreat | |
RoundPhase RoundFive = Adjust |
type family RoundOrderConstructor (roundStatus :: RoundStatus) :: Phase -> * where ... Source #
roundToInt :: Round -> Int Source #
gameZonedOrders :: Game round RoundUnresolved -> Map Zone (Aligned Unit, SomeOrderObject (RoundPhase round)) Source #
gameZonedResolvedOrders :: Game round RoundResolved -> Map Zone (Aligned Unit, SomeResolved OrderObject (RoundPhase round)) Source #
gameOccupation :: Game round roundStatus -> Occupation Source #
gameDislodged :: RoundPhase round ~ Retreat => Game round RoundUnresolved -> Map Zone (Aligned Unit) Source #
gameControl :: Game round roundStatus -> Control Source #
gameSeason :: Game round roundStatus -> Season Source #
issueOrders :: forall round. Map Zone (Aligned Unit, SomeOrderObject (RoundPhase round)) -> Game round RoundUnresolved -> (ValidateOrdersOutput (RoundPhase round), Game round RoundUnresolved) Source #
The game given as the second component of the return value will differ from the input game only if all orders are valid.
NB for adjust phase we wipe all build orders for every great power with at least one order appearing in the input order set; that's because there's no way to explicitly remove a build order by overwriting it with some other order. This is due to the way we represent build orders: they are in the game map alongside a unit which doesn't really exist yet. Removing this order involves removing that entry in the map.
removeBuildOrders :: RoundPhase round ~ Adjust => Set GreatPower -> Game round RoundUnresolved -> Game round RoundUnresolved Source #
resolve :: Game round RoundUnresolved -> Game round RoundResolved Source #
continue :: Game round RoundResolved -> Game (NextRound round) RoundUnresolved Source #