I\'m in an introductory software development class, and my homework is to create a rock paper scissors program that takes two arguments (rock, paper), etc, and returns the arg t
def winner(p1, p2) wins = {rock: :scissors, scissors: :paper, paper: :rock} {true => p1, false => p2}[wins[p1] == p2] end
winner(:rock, :rock) # => :rock d'oh! – tokland
Per @sarnold, leaving this as an exercise for the student :).