Skip to content

Instantly share code, notes, and snippets.

@waterlink
Created October 15, 2018 16:02
Show Gist options
  • Save waterlink/cbe568de1a4e21ce4f738a58cf72f04b to your computer and use it in GitHub Desktop.
Save waterlink/cbe568de1a4e21ce4f738a58cf72f04b to your computer and use it in GitHub Desktop.
step - 14
fun play(first: Throw, second: Throw): Winner {
if (first == second) {
return TIE
}
return when (first to second) {
SCISSORS to PAPER,
PAPER to ROCK,
ROCK to SCISSORS -> FIRST_PLAYER
else -> SECOND_PLAYER
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment