Class: Rpsshoot::Computer

Inherits:
Player
  • Object
show all
Defined in:
lib/rpsshoot/player.rb

Overview

Computer class manages AI player in one player mode

Instance Attribute Summary

Attributes inherited from Player

#name, #symbol

Instance Method Summary collapse

Constructor Details

#initialize(symbol, name) ⇒ Computer

Returns a new instance of Computer.



33
34
35
# File 'lib/rpsshoot/player.rb', line 33

def initialize(symbol, name)
  super
end

Instance Method Details

#shootObject

Computer takes a turn



38
39
40
41
# File 'lib/rpsshoot/player.rb', line 38

def shoot
  options = ["rock", "paper", "scissors"]
  shoot = options.sample
end