Safe Haskell | Safe |
---|
Game.Monad
Synopsis
- newtype GameMonad a = GameMonad {}
- execState :: GameMonad a -> GameState -> GameState
- execStateWithUndo :: GameMonad a -> GameState -> GameState
- get' :: GameMonad GameState
- getConfig :: GameMonad GameConfig
- getGlobalState :: GameMonad GlobalGameState
- getCells :: GameMonad CellStates
- getCell :: BoardCoordinate -> GameMonad CellState
- setCell :: BoardCoordinate -> CellState -> GameMonad ()
Documentation
Monad to evaluate game a move in
Arguments
:: GameMonad a | action to be executed |
-> GameState | current state of the game |
-> GameState | game state after the action |
evaluate an action on a GameState and return new state
execStateWithUndo :: GameMonad a -> GameState -> GameState #
same as execState
but save previous state for undo operations
getConfig :: GameMonad GameConfig #
get the GameConfig
of the current state
getGlobalState :: GameMonad GlobalGameState #
get the GlobalGameState
of the current state
getCells :: GameMonad CellStates #
get the CellStates
of the current state
getCell :: BoardCoordinate -> GameMonad CellState #
get the CellState
of the cell at given coordinate
setCell :: BoardCoordinate -> CellState -> GameMonad () #
update the CellState
at the given coordinate
this will also automatically update the GlobalGameState