Hey I am new to ruby and I have sat for a long time trying to find out what I've done wrong in this code, there isn't any error but it isn't giving me my desired output as a normal game of rock paper scissors. Here is my code:
puts "Rock, Paper or Scissors"
choice = gets.chomp
cchoice = ["Rock", "Paper","Scissors"]
comp = rand(1..3)
won = false
puts "Computer chose #{cchoice[comp]}"
if (choice == "Rock")
if (comp == 2)
won = false
end
if (comp == 3)
won = true
end
elsif (choice == "Paper")
if (comp == 3)
won = false
end
if (comp == 1)
won = true
end
elsif (choice == "Scissors")
if (comp == 1)
won = false
end
if (comp == 2)
won = true
end
else
puts "I dont know what that means so-"
end
if (won)
puts "YOU WON!!!"
else
puts "You lost.."
end
Thanks for any help!