Class: Kaibaibo::CompPlayer

Inherits:
Player
  • Object
show all
Defined in:
lib/kaibaibo/compplayer.rb

Instance Attribute Summary

Attributes inherited from Player

#name, #status

Instance Method Summary collapse

Methods inherited from Player

get_name, #throw

Constructor Details

#initializeCompPlayer

Returns a new instance of CompPlayer.



4
5
6
# File 'lib/kaibaibo/compplayer.rb', line 4

def initialize
  super("computer")
end

Instance Method Details

#gather_choiceObject



8
9
10
11
# File 'lib/kaibaibo/compplayer.rb', line 8

def gather_choice
  choices = [:rock, :paper, :scissors]
  throw(choices[rand(3)])
end