Created
October 15, 2018 15:49
-
-
Save waterlink/16c803dde5dbb8ca49d5f37bb5a6dac7 to your computer and use it in GitHub Desktop.
step - 8
This file contains hidden or 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
| interface Throw { | |
| val winsAgainst: List<Throw> | |
| fun beats(other: Throw) = winsAgainst.contains(other) | |
| object SCISSORS : Throw { | |
| override val winsAgainst = listOf(PAPER, LIZARD) | |
| } | |
| object PAPER : Throw { | |
| override val winsAgainst = listOf(ROCK, SPOCK) | |
| } | |
| object ROCK : Throw { | |
| override val winsAgainst = listOf(SCISSORS, LIZARD) | |
| } | |
| object LIZARD : Throw { | |
| override val winsAgainst = listOf(SPOCK, PAPER) | |
| } | |
| object SPOCK : Throw { | |
| override val winsAgainst = listOf(SCISSORS, ROCK) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment