Sha256: 58726768de396218c07756ae36618e4c3d03054450dfd343f53c92fd308d7ce5
Contents?: true
Size: 711 Bytes
Versions: 6
Compression:
Stored size: 711 Bytes
Contents
private; module PrivateMethods class << self def player_choice loop do print "Choose rock (r), paper (p) or scissors (s): ".green.bold; choice = gets.chomp.downcase; return Constants::NTRY_TO_SYM[choice] if Constants::NTRY_TO_SYM.key?(choice); puts "That entry is invalid. Please re-enter.".green.bold; end; end; def player_outcome(plays) return :WIN if Constants::WINNERS.include?(plays); return :LOSE if Constants::LOSERS.include?(plays); return :TIE if !:WIN | !:LOSE; end; def final_outcome(pl, co) return :WIN if pl > co; return :LOSE if pl < co; return :TIE if pl = co; end; end; end;
Version data entries
6 entries across 6 versions & 1 rubygems