Class: PaperRockScissors::Human

Inherits:
Object
  • Object
show all
Defined in:
lib/paper_rock_scissors/game.rb

Instance Method Summary collapse

Instance Method Details

#check_move(move) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/paper_rock_scissors/game.rb', line 51

def check_move(move)
  if %w(P R S).include?(move)
    return move
  else
    puts "Invalid Choice!"
    get_move
  end
end

#get_moveObject



45
46
47
48
49
# File 'lib/paper_rock_scissors/game.rb', line 45

def get_move
  print "Choose (P) for paper, (R) for rock, or (S) for scissors. >> "
  move = gets.chomp.upcase
  check_move(move)
end