Skip to content

Instantly share code, notes, and snippets.

@pjazdzewski1990
Created May 15, 2015 11:41
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 pjazdzewski1990/ff4ae7fc64b5d36da4f6 to your computer and use it in GitHub Desktop.
Save pjazdzewski1990/ff4ae7fc64b5d36da4f6 to your computer and use it in GitHub Desktop.
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