Skip to content

Instantly share code, notes, and snippets.

@CharlieHess
Last active August 26, 2015 05:34
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save CharlieHess/6c247bad6b3077c13c22 to your computer and use it in GitHub Desktop.
Old Fashioned Procedural Ways
doABettingRound(players) {
for (let player of players) {
tellThatPlayerToAct(player);
startATimer(timerCallback);
seeIfTheySentAMessage(messageCallback);
}
}
...
timerCallback(timeLeft) {
if (booleanFlagSaysTheyActed) {
cancelThisTimer();
} else if (timeLeft === 0) {
anotherBooleanFlagTimeExpired = true;
}
}
messageCallback(theMessage) {
if (anotherBooleanFlagTimeExpired) {
// lol too late
return;
} else {
booleanFlagSaysTheyActed = true;
// lol now we need to remember this
// because it effects the next player
saveThatMessage(theMessage);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment