Safe HaskellSafe

Game.Logic

Synopsis

Documentation

newGame :: GameConfig -> GameState #

create a new GameState for given GameConfig

this will initialize CellStates with the respective dimensions

getCellFixed #

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

reveal #

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

updateCountdownLabel :: BoardCoordinate -> GameMonad () #

updated the countdown label based on adjacent flags