Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- desc "Play rock in rock-paper-scissors"
- a=["Rock", "Paper", "Scissors"]
- task :play_rock do
- ap("We played rock!")
- if a.sample=="Rock"
- ap("The computer chose rock! You tied!")
- elsif a.sample=="Paper"
- ap("The computer chose paper! You lost!")
- else a.sample=="Scissors"
- ap("The computer chose scissors! You won!") end
- end
- desc "Play paper in rock-paper-scissors"
- task :play_paper do
- ap("We played paper!")
- if a.sample=="Rock"
- ap("The computer chose rock! You won!")
- elsif a.sample=="Paper"
- ap("The computer chose paper! You tied!")
- else a.sample=="Scissors"
- ap("The computer chose scissors! You lost!") end
- end
- desc "Play scissors in rock-paper-scissors"
- task :play_scissors do
- ap("We played scissors!")
- if a.sample=="Rock"
- ap("The computer chose rock! You lost!")
- elsif a.sample=="Paper"
- ap("The computer chose paper! You won!")
- else a.sample=="Scissors"
- ap("The computer chose scissors! You tied!") end
- end
Add Comment
Please, Sign In to add comment