module Utils

Public Instance Methods

clear_draw_hands() click to toggle source
# File lib/blackjack/utils.rb, line 19
def clear_draw_hands
  clear
  draw_hands
end
clear_draw_hands_ask_insurance() click to toggle source
# File lib/blackjack/utils.rb, line 34
def clear_draw_hands_ask_insurance
  clear_draw_hands
  ask_insurance
end
clear_draw_hands_bet_options() click to toggle source
# File lib/blackjack/utils.rb, line 39
def clear_draw_hands_bet_options
  clear_draw_hands
  draw_bet_options
end
clear_draw_hands_game_options() click to toggle source
# File lib/blackjack/utils.rb, line 44
def clear_draw_hands_game_options
  clear_draw_hands
  draw_game_options
end
clear_draw_hands_new_deck_type() click to toggle source
# File lib/blackjack/utils.rb, line 29
def clear_draw_hands_new_deck_type
  clear_draw_hands
  new_deck_type
end
clear_draw_hands_new_num_decks() click to toggle source
# File lib/blackjack/utils.rb, line 24
def clear_draw_hands_new_num_decks
  clear_draw_hands
  new_num_decks
end
draw_hands_current_hand_action() click to toggle source
# File lib/blackjack/utils.rb, line 49
def draw_hands_current_hand_action
  draw_hands
  current_player_hand.action?
end
load_game() click to toggle source
# File lib/blackjack/utils.rb, line 10
def load_game
  return unless File.readable?(SAVE_FILE)

  a = File.read(SAVE_FILE).split('|')
  self.num_decks = a[0].to_i
  self.money = a[1].to_i
  self.current_bet = a[2].to_i
end
play_dealer_hand() click to toggle source
# File lib/blackjack/utils.rb, line 54
def play_dealer_hand
  dealer_hand.play
  draw_hands
  draw_bet_options
end
save_game() click to toggle source
# File lib/blackjack/utils.rb, line 4
def save_game
  File.open(SAVE_FILE, 'w') do |file|
    file.puts "#{num_decks}|#{money}|#{current_bet}"
  end
end