Old Fashioned Procedural Ways
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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