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