Class: Blackjack::Turn
- Inherits:
-
Object
- Object
- Blackjack::Turn
- Defined in:
- lib/blackjack/turn.rb
Constant Summary collapse
- HIT =
"h"
- VALID_OPTIONS =
['h', 's']
Instance Attribute Summary collapse
-
#deck ⇒ Object
Returns the value of attribute deck.
-
#input ⇒ Object
Returns the value of attribute input.
-
#player ⇒ Object
Returns the value of attribute player.
Instance Method Summary collapse
-
#initialize(args) ⇒ Turn
constructor
A new instance of Turn.
- #take ⇒ Object
Constructor Details
#initialize(args) ⇒ Turn
Returns a new instance of Turn.
7 8 9 10 11 |
# File 'lib/blackjack/turn.rb', line 7 def initialize(args) @player = args[:player] @deck = args[:deck] @input end |
Instance Attribute Details
#deck ⇒ Object
Returns the value of attribute deck.
6 7 8 |
# File 'lib/blackjack/turn.rb', line 6 def deck @deck end |
#input ⇒ Object
Returns the value of attribute input.
6 7 8 |
# File 'lib/blackjack/turn.rb', line 6 def input @input end |
#player ⇒ Object
Returns the value of attribute player.
6 7 8 |
# File 'lib/blackjack/turn.rb', line 6 def player @player end |
Instance Method Details
#take ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/blackjack/turn.rb', line 13 def take 2.times do puts deal_to_player end until over? puts player.formatted_score puts hit_or_stand end end |