Class: AnnRps::Game
- Inherits:
-
Object
- Object
- AnnRps::Game
- Defined in:
- lib/ann_rps.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Game
constructor
A new instance of Game.
Constructor Details
Class Method Details
.winner(player_choice, comp_choice) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/ann_rps.rb', line 47 def self.winner(player_choice, comp_choice ) case player_choice when "r" if comp_choice == "r" puts "It's a tie!" elsif comp_choice == "p" puts "I win! Better luck next time." else puts "You win!" end when "p" if comp_choice == "r" puts "You win!" elsif comp_choice == "p" puts "It's a tie!" else puts "I win! Better luck next time." end when "s" if comp_choice == "r" puts puts "I win! Better luck next time." elsif comp_choice == "p" puts "You win!" else puts "It's a tie!" end end end |