Safe Haskell | Safe |
---|
Game.Logic
Synopsis
- newGame :: GameConfig -> GameState
- getCellFixed :: Bool -> BoardCoordinate -> GameMonad CellState
- execAction :: GameAction -> GameState -> GameState
- revealArea :: BoardCoordinate -> GameMonad ()
- reveal :: Bool -> BoardCoordinate -> GameMonad ()
- neighborCoordinates :: BoardCoordinate -> GameMonad [BoardCoordinate]
- toggleFlagState :: BoardCoordinate -> GameMonad ()
- updateCountdownLabel :: BoardCoordinate -> GameMonad ()
Documentation
newGame :: GameConfig -> GameState #
create a new GameState
for given GameConfig
this will initialize CellStates
with the respective dimensions
Arguments
:: Bool | always return a safe cell if possible (effectively allow guessing anywhere) |
-> BoardCoordinate | coordinate of cell to reveal |
-> GameMonad CellState |
get a cell with fixed internal state
this will first update the requested cell if necessary (i.e. cell is Undefined
)
assigning the cell to contain a mine or not
execAction :: GameAction -> GameState -> GameState #
evaluate a single move of the player and return the new GameState
revealArea :: BoardCoordinate -> GameMonad () #
reveal all adjacent safe cells - according to set flags
Arguments
:: Bool | force reveal of flagged cells if safe (recursively used when no adjacent mines) |
-> BoardCoordinate | coordinates to reveal |
-> GameMonad () |
reveal a single cell
neighborCoordinates :: BoardCoordinate -> GameMonad [BoardCoordinate] #
get coordinates of adjacent cells
toggleFlagState :: BoardCoordinate -> GameMonad () #
updateCountdownLabel :: BoardCoordinate -> GameMonad () #
updated the countdown label based on adjacent flags