Created
November 22, 2011 04:29
-
-
Save anonymous/1384895 to your computer and use it in GitHub Desktop.
Ruby golf: Rock, Paper, Scissors
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
def play(g) | |
r,p,s=%w(rock paper scissors);a={r=>p,p=>s,s=>r};m=a.keys[rand(a.size)];m+','+(g==m ?"draw":(a[m]==g ?"win":"lose")) | |
end | |
# 116 chars inside |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment