Safe Haskell | None |
---|
This module implements Game management. a game is a set of rules, and results of actions made by players (usually vote results) the module manages the effects of rules over each others.
- data GameEvent
- = GameSettings GameName GameDesc UTCTime
- | JoinGame PlayerNumber PlayerName
- | LeaveGame PlayerNumber
- | ProposeRuleEv PlayerNumber SubmitRule
- | InputChoiceResult PlayerNumber EventNumber Int
- | InputStringResult PlayerNumber String String
- | OutputPlayer PlayerNumber String
- | TimeEvent UTCTime
- | SystemAddRule SubmitRule
- update :: GameEvent -> StateT LoggedGame IO ()
- update' :: Maybe (RuleCode -> IO RuleFunc) -> GameEvent -> StateT LoggedGame IO ()
- data LoggedGame = LoggedGame {}
- game :: Lens LoggedGame Game
- gameLog :: Lens LoggedGame [TimedEvent]
- emptyGame :: GameName -> GameDesc -> UTCTime -> Game
- execWithGame :: UTCTime -> State LoggedGame () -> LoggedGame -> LoggedGame
- execWithGame' :: UTCTime -> StateT LoggedGame IO () -> LoggedGame -> IO LoggedGame
- outputAll :: String -> StateT LoggedGame IO ()
- getLoggedGame :: Game -> (RuleCode -> IO RuleFunc) -> [TimedEvent] -> IO LoggedGame
- tracePN :: Monad m => Int -> String -> m ()
- getTimes :: EventHandler -> Maybe UTCTime
- activeRules :: Game -> [Rule]
- pendingRules :: Game -> [Rule]
- rejectedRules :: Game -> [Rule]
Documentation
update :: GameEvent -> StateT LoggedGame IO ()Source
gameLog :: Lens LoggedGame [TimedEvent]Source
execWithGame :: UTCTime -> State LoggedGame () -> LoggedGame -> LoggedGameSource
An helper function to use the state transformer GameState. It additionally sets the current time.
execWithGame' :: UTCTime -> StateT LoggedGame IO () -> LoggedGame -> IO LoggedGameSource
outputAll :: String -> StateT LoggedGame IO ()Source
getLoggedGame :: Game -> (RuleCode -> IO RuleFunc) -> [TimedEvent] -> IO LoggedGameSource
activeRules :: Game -> [Rule]Source
pendingRules :: Game -> [Rule]Source
rejectedRules :: Game -> [Rule]Source