Sha256: f376364056d44392e45c86a33ef3ad6c91dd2312e7bee42275c445dc1070fee7

Contents?: true

Size: 1004 Bytes

Versions: 1

Compression:

Stored size: 1004 Bytes

Contents

require "colorize"
require_relative "between_the_sheets/application_exit"
require_relative "between_the_sheets/application_help"
require_relative "between_the_sheets/ask"
require_relative "between_the_sheets/card"
require_relative "between_the_sheets/game"
require_relative "between_the_sheets/game_over"
require_relative "between_the_sheets/wager"
require_relative "between_the_sheets/version"

module BetweenTheSheets
  running = true

  loop do
    begin
      raise ApplicationExit unless running

      @game = Game.new(@jackpot || Game::STARTING_JACKPOT)
      @game.execute
    rescue GameOver
      @jackpot = @game.jackpot
      puts Game.message :game_over
      running = Ask.print("Play again? ", match: /y|n/) == "y"
    rescue ApplicationHelp
      puts Game.message :help
    rescue ApplicationExit, SystemExit, Interrupt
      puts Game.message :exit
      break
    rescue => e
      # TODO log e.message
      puts Game.message :error
      puts e.message
      break
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
between_the_sheets-1.0.4 lib/between_the_sheets.rb