swarm-0.3.0.0: 2D resource gathering game with programmable robots
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.TUI.Model.StateUpdate

Synopsis

Documentation

startGame :: (MonadIO m, MonadState AppState m) => ScenarioInfoPair -> Maybe CodeToRun -> m () Source #

Load a Scenario and start playing the game.

restartGame :: (MonadIO m, MonadState AppState m) => Seed -> ScenarioInfoPair -> m () Source #

Re-initialize the game from the stored reference to the current scenario.

Note that "restarting" is intended only for "scenarios"; with some scenarios, it may be possible to get stuck so that it is either impossible or very annoying to win, so being offered an option to restart is more user-friendly.

Since scenarios are stored as a Maybe in the UI state, we handle the Nothing case upstream so that the Scenario passed to this function definitely exists.

scenarioToAppState :: (MonadIO m, MonadState AppState m) => ScenarioInfoPair -> Maybe Seed -> Maybe CodeToRun -> m () Source #

Modify the AppState appropriately when starting a new scenario.