Class: RockPaperScissors::Computer
- Defined in:
- lib/rock_paper_scissors/computer.rb
Instance Attribute Summary
Attributes inherited from Player
Instance Method Summary collapse
-
#initialize(board, player_number) ⇒ Computer
constructor
A new instance of Computer.
- #select_move ⇒ Object
Constructor Details
#initialize(board, player_number) ⇒ Computer
Returns a new instance of Computer.
5 6 7 8 |
# File 'lib/rock_paper_scissors/computer.rb', line 5 def initialize(board, player_number) super(board, player_number) @name = "Skynet" end |
Instance Method Details
#select_move ⇒ Object
10 11 12 13 |
# File 'lib/rock_paper_scissors/computer.rb', line 10 def select_move move = @board.plays.keys.sample.to_s @board.place_move(@player_number, move) end |