Last active
February 17, 2017 14:28
-
-
Save FredrikAugust/9a8a4be5ddd81a9133d35732ac21d199 to your computer and use it in GitHub Desktop.
Rock paper scissor in ruby, 232 bytes
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
p 'Would you like to play a game?' | |
abort 'I hope to play sometime' unless gets.chomp.upcase.ord==89 | |
p 'Rock, paper or scissors?' | |
p (s=(a={82=>83,80=>82,83=>80}).keys.sample)==(i=gets.upcase.ord) ? 'Tie' : (a[i]==s ? 'Win' : 'Loss') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment