Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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