Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def tickCountdown(): Game = {
val countdownUpdated = TurnCountdownUpdated(id, turn.secondsLeft - 1)
if (turn.secondsLeft <= 1) {
val timedOut = TurnTimedOut(id)
nextPlayerOpt match {
case Some(nextPlayer) =>
applyEvents(countdownUpdated, timedOut, TurnChanged(id, Turn(nextPlayer, turnTimeoutSeconds)))
case None =>
applyEvents(countdownUpdated, timedOut, GameFinished(id, bestPlayers))
}
} else applyEvent(countdownUpdated)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment