<commit_before>require_relative 'game'
require_relative 'card'
require_relative 'view'

def play(file)

  game = Game.new()
  view = View.new()
  game.load_cards(file)
  game.create_cards

  if view.start_game == "yes"
    number = 1
    while game.results.has_key?(false) == true
      view.round(number)
      game.deck.each_with_index do |card, index|
        view.show_question(game.ask_question(index))
        view.response(game.correct?(view.get_answer, index))
        view.show_answer(card)
      end
      game.count_results
      if game.results.has_key?(false) == false
        if view.end_game == "yes"
          view.continue
          play
        end
      else
        view.show_results(game.results)
        game.reset_deck
        number += 1
      end
    end
    view.thanks
  end
end

  if ARGV[0] == "begin"
    play(ARGV[1])
  elsif ARGV[0] == "cards"
    game = Game.new()
    view = View.new()
    game.load_cards(ARGV[1])<commit_msg>Fixed ARGV with global variable<commit_after>require_relative 'game'
require_relative 'card'
require_relative 'view'


def play(file)
  game = Game.new()
  view = View.new()
  game.load_cards($file)
  game.create_cards

  if view.start_game == "yes"
    number = 1
    while game.results.has_key?(false) == true
      view.round(number)
      game.deck.each_with_index do |card, index|
        view.show_question(game.ask_question(index))
        view.response(game.correct?(view.get_answer, index))
        view.show_answer(card)
      end
      game.count_results
      if game.results.has_key?(false) == false
        if view.end_game == "yes"
          view.continue
          play($file)
        end
      else
        view.show_results(game.results)
        game.reset_deck
        number += 1
      end
    end
    view.thanks
  end
end

  if ARGV[0] == "begin"
    $file = ARGV[1]
    play(ARGV[1])
  elsif ARGV[0] == "cards"
    game = Game.new()
    view = View.new()
    game.load_cards(ARGV[1])
{'fraction_non_alphanumeric': 0.1190233977619532, 'fraction_numerical': 0.006612410986775178, 'mean_word_length': 2.426829268292683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2717426', 'n_tokens_mistral': 683, 'n_tokens_neox': 670, 'n_words': 133}