Class: Player

Inherits:
Object
  • Object
show all
Defined in:
lib/cardtable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePlayer

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

#handObject

Returns the value of attribute hand.



273
274
275
# File 'lib/cardtable.rb', line 273

def hand
  @hand
end

#isawinnerObject

Returns the value of attribute isawinner.



273
274
275
# File 'lib/cardtable.rb', line 273

def isawinner
  @isawinner
end

#scoreObject

Returns the value of attribute score.



273
274
275
# File 'lib/cardtable.rb', line 273

def score
  @score
end

Instance Method Details

#resetObject



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