Class: Player
- Inherits:
-
Object
- Object
- Player
- Defined in:
- lib/cardtable.rb
Instance Attribute Summary collapse
-
#hand ⇒ Object
Returns the value of attribute hand.
-
#isawinner ⇒ Object
Returns the value of attribute isawinner.
-
#score ⇒ Object
Returns the value of attribute score.
Instance Method Summary collapse
-
#initialize ⇒ Player
constructor
A new instance of Player.
- #reset ⇒ Object
Constructor Details
#initialize ⇒ Player
Returns a new instance of Player.
275 276 277 278 279 280 281 282 |
# File 'lib/cardtable.rb', line 275 def initialize # Initially, each player has an empty hand of cards and they are assumed # to be the loser of the game. This is in case the player kills the game # before the end and that player is assumed to have lost. self.hand = Array.new self.isawinner = false self.score = Array.new end |
Instance Attribute Details
#hand ⇒ Object
Returns the value of attribute hand.
273 274 275 |
# File 'lib/cardtable.rb', line 273 def hand @hand end |
#isawinner ⇒ Object
Returns the value of attribute isawinner.
273 274 275 |
# File 'lib/cardtable.rb', line 273 def isawinner @isawinner end |
#score ⇒ Object
Returns the value of attribute score.
273 274 275 |
# File 'lib/cardtable.rb', line 273 def score @score end |
Instance Method Details
#reset ⇒ Object
284 285 286 287 288 289 |
# File 'lib/cardtable.rb', line 284 def reset # Blow away any old data and star again self.hand.clear self.score.clear Player.new end |