Class: LiarsDice::Seat

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(number, player, starting_dice) ⇒ Seat

Returns a new instance of Seat.



6
7
8
9
10
# File 'lib/liars_dice/seat.rb', line 6

def initialize(number, player, starting_dice)
  self.number = number
  @dice_left = starting_dice
  self.player = player
end

Instance Attribute Details

#diceObject

Returns the value of attribute dice.



4
5
6
# File 'lib/liars_dice/seat.rb', line 4

def dice
  @dice
end

#dice_leftObject (readonly)

Returns the value of attribute dice_left.



4
5
6
# File 'lib/liars_dice/seat.rb', line 4

def dice_left
  @dice_left
end

#numberObject

Returns the value of attribute number.



3
4
5
# File 'lib/liars_dice/seat.rb', line 3

def number
  @number
end

#playerObject

Returns the value of attribute player.



3
4
5
# File 'lib/liars_dice/seat.rb', line 3

def player
  @player
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/liars_dice/seat.rb', line 12

def alive?
  dice_left > 0
end

#lose_dieObject



21
22
23
# File 'lib/liars_dice/seat.rb', line 21

def lose_die
  @dice_left -= 1
end