Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- things = ["Scissors", "Paper", "Rock", "Lizard", "Spock"]
- bot = things.sample
- puts "Let's play a round of RPSLS!\n Choose wisely:\n\t0) #{things[0]}\n\t1) #{things[1]}\n\t2) #{things[2]}\n\t3) #{things[3]}\n\t4) #{things[4]}\n"
- player = things[gets.chomp.to_i]
- conditions = ["I chose #{bot}. Draw", "I chose #{bot}. You lose! #{bot} beats #{player}.", "I chose #{bot}. You win! #{player} beats #{bot}."]
- distance = (things.index(player) - things.index(bot))
- puts conditions[distance == 0 ? 0 : ([1,-2,3,-4].include?(distance) ? 1 : -1)]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement