Skip to content

Instantly share code, notes, and snippets.

@senritsu
Created February 13, 2021 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save senritsu/4fa21691cd08c6fb7906f25280355206 to your computer and use it in GitHub Desktop.
Save senritsu/4fa21691cd08c6fb7906f25280355206 to your computer and use it in GitHub Desktop.
Simple Deckbuilder
Simple Deckbuilder
# set up decks, etc.
Preparation*
done -> Turn
Turn
# user is able to to something here
Idle*
play card -> Executing action
end turn -> End of turn
# mostly animation and context changes
Executing action
Prerequisites met?*
yes? -> Apply effects
no? -> Show error
Show error
done -> Idle
Apply effects
done -> Idle
# mostly animation and context changes
End of turn
Last turn of final round?*
yes? -> Tally Score
no? -> Discard played cards
Discard played cards
done -> Draw new hand
Draw new hand
Draw?*
deck and discard empty? -> Next player
hand full? -> Next player
deck empty? -> Shuffle Deck
hand not full? -> Draw
Shuffle Deck
done -> Draw?
Draw
done -> Draw?
# increment round/turn and show player(s) round/turn number and whose turn it is
Next player
done -> Turn
# show scores to the player(s)
Tally Score
restart -> Preparation
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