Created
May 15, 2015 11:36
-
-
Save pjazdzewski1990/3b5bb89ba83d1575b04d 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
sealed trait Game { | |
def handleCommand(command: GameCommand): Either[GameRulesViolation, Game] | |
def applyEvent: PartialFunction[GameEvent, Game] | |
} | |
case class UninitializedGame(...) extends Game { | |
def start(players: Seq[PlayerId]): Either[GameRulesViolation, Game] | |
} | |
case class RunningGame(...) extends Game { | |
def roll(player: PlayerId): Either[GameRulesViolation, Game] | |
def tickCountdown(): Game | |
} | |
case class FinishedGame(...) extends Game {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment