Created
February 16, 2014 14:09
-
-
Save Ank13/9034759 to your computer and use it in GitHub Desktop.
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
puts "Rock, Paper, Scissors, shoot!" | |
puts "(enter your choice)" | |
user_choice = gets.chomp.downcase | |
choices = ["rock", "paper", "scissors"] | |
computer_choice = choices[rand(3)] | |
puts "The computer chooses #{computer_choice}!" | |
puts "Tie!" if user_choice == computer_choice | |
if user_choice == "scissors" && computer_choice == "paper" || | |
user_choice == "rock" && computer_choice == "scissors" || | |
user_choice == "paper" && computer_choice == "rock" | |
puts "You win" | |
else | |
puts "You lose!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment