Skip to content

Instantly share code, notes, and snippets.

@freddydumont
Last active April 3, 2019 22:02
Show Gist options
  • Save freddydumont/e4a1b3add5842fca20be9476099429e2 to your computer and use it in GitHub Desktop.
Save freddydumont/e4a1b3add5842fca20be9476099429e2 to your computer and use it in GitHub Desktop.
Game
Game
Board
mines generated?
isNotGenerated? -> Generate mines
isGenerated? -> Reveal
Generate mines
done? -> Reveal
# Display game over screen
Game Over
Tile*
Default
left click -> isFirstClick?
right click -> Flag
neighbour revealed -> Evaluating
isFirstClick?
first click? -> mines generated?
not first click -> isMined?
isMined?
mined? -> Game Over
not_mined? -> Reveal
Evaluating
isZero? -> Reveal
notZero? -> Default
Flag
RIGHT_CLICK -> Mark
Mark
LEFT_CLICK -> isMined?
RIGHT_CLICK -> Default
# dispatch event neighbour_revealed to surrounding tiles
Reveal
function render(model){
let current_state_name = model.active_states[0].name;
return $("h1",
{style: {color: "darkBlue"}},
`The current state is: ${current_state_name}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment