Class: SakuRps::HumanPlayer
Constant Summary collapse
- PLAY_OPTIONS =
%w(1 2 3 R P S ROCK PAPER SCISSORS).freeze
Instance Attribute Summary
Attributes inherited from Player
Instance Method Summary collapse
Methods inherited from Player
Constructor Details
This class inherits a constructor from SakuRps::Player
Instance Method Details
#choose_play ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/saku_rps/player.rb', line 21 def choose_play begin puts 'Please select your play!' puts '1. Rock' puts '2. Paper' puts '3. Scissors' print '> ' choice = gets.chomp end until PLAY_OPTIONS.include?(choice) case choice when '1', 'R', 'ROCK' choice = 'ROCK' when '2', 'P', 'PAPER' choice = 'PAPER' when '3', 'S', 'SCISSORS' choice = 'SCISSORS' end self.choice = choice nil end |