Module: SplitHand

Included in:
Blackjack
Defined in:
lib/blackjack/split_hand.rb

Instance Method Summary collapse

Instance Method Details

#expand_split_handsObject



31
32
33
34
35
36
37
38
39
# File 'lib/blackjack/split_hand.rb', line 31

def expand_split_hands
  player_hands << PlayerHand.new(self, current_bet)

  x = player_hands.size - 1
  while x > current_hand
    player_hands[x] = player_hands[x - 1].clone
    x -= 1
  end
end

#split_current_handObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/blackjack/split_hand.rb', line 4

def split_current_hand
  if current_player_hand.can_split?
    expand_split_hands
    this_hand = split_hand

    if this_hand.done?
      this_hand.process
    else
      draw_hands_current_hand_action
    end
  else
    draw_hands_current_hand_action
  end
end

#split_handObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/blackjack/split_hand.rb', line 19

def split_hand
  this_hand = player_hands[current_hand]
  split_hand = player_hands[current_hand + 1]

  split_hand.cards = []
  split_hand.cards << this_hand.cards.last
  this_hand.cards.pop

  this_hand.cards << shoe.next_card
  this_hand
end