Created
May 15, 2015 11:38
-
-
Save pjazdzewski1990/41569d4e2c0c5356fb5f 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 handleCommand(command: GameCommand): Either[GameRulesViolation, Game] = command match { | |
case StartGame(players) => this match { | |
case ug: UninitializedGame => ug.start(players) | |
case _ => GameAlreadyStartedViolation | |
} | |
case RollDice(player) => this match { | |
case rg: RunningGame => rg.roll(player) | |
case _ => GameNotRunningViolation | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment