class AnnRps::Game
Public Class Methods
new()
click to toggle source
# File lib/ann_rps.rb, line 43 def initialize @game = Game.new end
winner(player_choice, comp_choice )
click to toggle source
# 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