Nomyx-Language-0.4.1: Language to express rules for Nomic

Safe HaskellNone



This module implements the events that can affect a game.



data LoggedGame Source

A game being non serializable, we have to store events in parralel in order to rebuild the state latter.




_game :: Game
_gameLog :: [TimedEvent]

enactEvent :: GameEvent -> Maybe (RuleCode -> IO RuleFunc) -> StateT Game IO ()Source

perform a game event

gameSettings :: GameName -> GameDesc -> UTCTime -> State Game ()Source

initialize the game.

joinGame :: PlayerName -> PlayerNumber -> State Game ()Source

join the game.

leaveGame :: PlayerNumber -> State Game ()Source

leave the game.

proposeRule :: SubmitRule -> PlayerNumber -> (RuleCode -> IO RuleFunc) -> StateT Game IO ()Source

insert a rule in pending rules.

systemAddRule :: SubmitRule -> (RuleCode -> IO RuleFunc) -> StateT Game IO ()Source

add a rule forcefully (no votes etc.)

logGame :: String -> Maybe PlayerNumber -> State Game ()Source

insert a log message.

inputResult :: PlayerNumber -> EventNumber -> UInputData -> State Game ()Source

the user has provided an input result

execWithGame :: UTCTime -> State LoggedGame () -> LoggedGame -> LoggedGameSource

A helper function to use the state transformer GameState. It additionally sets the current time.

stateCatch :: StateT s IO a -> (SomeException -> StateT s IO a) -> StateT s IO aSource