Guest User

Untitled

a guest
Apr 25th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. desc "Play rock in rock-paper-scissors"
  2. a=["Rock", "Paper", "Scissors"]
  3.  
  4. task :play_rock do
  5.  
  6. ap("We played rock!")
  7.  
  8. if a.sample=="Rock"
  9. ap("The computer chose rock! You tied!")
  10. elsif a.sample=="Paper"
  11. ap("The computer chose paper! You lost!")
  12. else a.sample=="Scissors"
  13. ap("The computer chose scissors! You won!") end
  14.  
  15. end
  16.  
  17. desc "Play paper in rock-paper-scissors"
  18. task :play_paper do
  19.  
  20. ap("We played paper!")
  21.  
  22. if a.sample=="Rock"
  23. ap("The computer chose rock! You won!")
  24. elsif a.sample=="Paper"
  25. ap("The computer chose paper! You tied!")
  26. else a.sample=="Scissors"
  27. ap("The computer chose scissors! You lost!") end
  28.  
  29. end
  30.  
  31. desc "Play scissors in rock-paper-scissors"
  32. task :play_scissors do
  33.  
  34. ap("We played scissors!")
  35. if a.sample=="Rock"
  36. ap("The computer chose rock! You lost!")
  37. elsif a.sample=="Paper"
  38. ap("The computer chose paper! You won!")
  39. else a.sample=="Scissors"
  40. ap("The computer chose scissors! You tied!") end
  41. end
Add Comment
Please, Sign In to add comment