Class: RedPlayer
- Inherits:
-
Object
- Object
- RedPlayer
- Defined in:
- lib/prisoners-dilemma/players/red.rb
Instance Attribute Summary collapse
-
#log ⇒ Object
Returns the value of attribute log.
Instance Method Summary collapse
- #cooperate? ⇒ Boolean
-
#initialize ⇒ RedPlayer
constructor
A new instance of RedPlayer.
Constructor Details
#initialize ⇒ RedPlayer
Returns a new instance of RedPlayer.
4 5 6 |
# File 'lib/prisoners-dilemma/players/red.rb', line 4 def initialize @log = [] end |
Instance Attribute Details
#log ⇒ Object
Returns the value of attribute log.
2 3 4 |
# File 'lib/prisoners-dilemma/players/red.rb', line 2 def log @log end |
Instance Method Details
#cooperate? ⇒ Boolean
8 9 10 |
# File 'lib/prisoners-dilemma/players/red.rb', line 8 def cooperate? [true, true, false].sample end |