Class: RockPaperScissors::Human
- Defined in:
- lib/rock_paper_scissors/human.rb
Instance Attribute Summary
Attributes inherited from Player
Instance Method Summary collapse
-
#initialize(board, player_number) ⇒ Human
constructor
A new instance of Human.
- #select_move ⇒ Object
Constructor Details
#initialize(board, player_number) ⇒ Human
Returns a new instance of Human.
7 8 9 10 |
# File 'lib/rock_paper_scissors/human.rb', line 7 def initialize(board, player_number) super(board, player_number) @name = get_name end |
Instance Method Details
#select_move ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/rock_paper_scissors/human.rb', line 12 def select_move loop do move = ask_move if valid_format?(move) break if @board.place_move(@player_number, move) end end end |