<commit_before>#script for running the game
require_relative('RunnerText')
require_relative('ai')
require_relative('player')

def run_setup(player,ai)
  #Says hello, and gets the name the player wants
  RunnerText.greeting()
  player.set('name', $stdin.gets.chomp.capitalize)

  #info about the situation
  RunnerText.declaration_of_love(player.get('name'),ai.get('name'),ai.get('language'))

  #asks the player for the language they want
  RunnerText.ask_for_language(player.get('name'))
  player.set('language',$stdin.gets.chomp)

  #asks the player for the standard upgrade they want
  RunnerText.ask_about_upgrade(player.get('language'),ai.get('name'))
  upgrade_input = $stdin.gets.chomp
  if upgrade_input.include?('b')
    player.add('bold')
  elsif upgrade_input.include?('i')
    player.add('italic')
  elsif upgrade_input.include?('u')
    player.add('underlined')
  end

  #sets it up for GO TIME
  RunnerText.ready(player.get('name'),player.get('upgrade'),ai.get('name'),ai.get('upgrade'))

end

def print_player_info(player)
  puts "#{player.get('name')}, you have these options:"
  puts "\tyour ego: #{player.get('ego')}."
  puts "\tyour vocabulary: #{player.get('vocabulary')}."
  puts " "
  puts "\tyou can argue in #{player.get('language').name}, with"
  vowels = []
  player.get('language').vowels.each do |vowel|
    vowels.push(vowel.name)
  end
  puts "\t\t vowels: #{vowels},"
  consonants = []
  player.get('language').consonants.each do |consonant|
    consonants.push(consonant.name)
  end
  puts "\t\t consonants: #{consonants},"
  words = []
  player.get('language').words.each do |word|
    words.push(word.spelling)
  end
  puts "\t\t words: #{words},"
  puts ""
  puts "\t\t-arg.\t-\#arg1,arg2..."
  puts ""
  puts "\tor take a hit to your ego in silence. ~no"
  puts ""
  puts "\tor read the dictionary. ~-read"
  puts "\t\t this will give you \*+2\* vocabulary, and a new \*vowel/cons/word\*"

  puts "\n..you can always also quit, any time :)\n\n"
end

def is_a_player_opt(language,arg)
  player_opt = []
  language.vowels.each do |vowel|
    player_opt.push(vowel.name)
  end
  language.consonants.each do |consonant|
    player_opt.push(consonant.name)
  end
  language.words.each do |word|
    player_opt.push(word.spelling)
  end
  if player_opt.include?(arg)
    return true
  else
    return false
  end
end

def run_game(player,ai)
  prompt = ')> '
  puts "running game"
  vowel =  ai.calc_next_move(" ")
  puts "ai decided that '#{vowel}' would do"
  ego_dead = 0
  arg_result = ""
  player_won = false

  #THE CORE LOOP!
  while player.get('ego') != ego_dead && ai.get('ego') != ego_dead
    print "counter argument?", prompt
    arg = $stdin.gets.chomp
    case arg
    when is_a_player_opt(player.get('language'),arg)      #TODO these two!
      arg_result = "You're sending #{arg}!"
    when "no"
      arg_result = "ok.."
    when "-h"
      print_player_info(player)
      next
    when "-read"
      arg_result = "\*learning shit\*"
    when "quit"
      puts "LOL, quitter!"
      exit(0)
    when !is_a_player_opt(player.get('language'),arg)      #TODO these two!
      arg_result = "what was that??"
    else
      puts "no cheating!"
      next
    end
    puts arg_result
    if false #arg_result -> ai_ego = 0
      player_won = true
      return
    elsif false #arg_result -> player_ego = 0
      return
    else #new round
      puts "\*ai thinking\*"
      ego_dead += 1
      puts "count : #{ego_dead}"
      arg_result = ""
    end
  end

  #GAME OVER

  #if won
  #puts "YEY!!! WE KNEW IT! OF COURSE YOU CONVINCED THE OPPOSER!"

  #if lost<commit_msg>the player options right/wrong is 'working' the if in the chekc is not.... somehow..<commit_after>#script for running the game
require_relative('RunnerText')
require_relative('ai')
require_relative('player')

def run_setup(player,ai)
  #Says hello, and gets the name the player wants
  RunnerText.greeting()
  player.set('name', $stdin.gets.chomp.capitalize)

  #info about the situation
  RunnerText.declaration_of_love(player.get('name'),ai.get('name'),ai.get('language'))

  #asks the player for the language they want
  RunnerText.ask_for_language(player.get('name'))
  player.set('language',$stdin.gets.chomp)

  #asks the player for the standard upgrade they want
  RunnerText.ask_about_upgrade(player.get('language'),ai.get('name'))
  upgrade_input = $stdin.gets.chomp
  if upgrade_input.include?('b')
    player.add('bold')
  elsif upgrade_input.include?('i')
    player.add('italic')
  elsif upgrade_input.include?('u')
    player.add('underlined')
  end

  #sets it up for GO TIME
  RunnerText.ready(player.get('name'),player.get('upgrade'),ai.get('name'),ai.get('upgrade'))

end

def print_player_info(player)
  puts "#{player.get('name')}, you have these options:"
  puts "\tyour ego: #{player.get('ego')}."
  puts "\tyour vocabulary: #{player.get('vocabulary')}."
  puts " "
  puts "\tyou can argue in #{player.get('language').name}, with"
  vowels = []
  player.get('language').vowels.each do |vowel|
    vowels.push(vowel.name)
  end
  puts "\t\t vowels: #{vowels},"
  consonants = []
  player.get('language').consonants.each do |consonant|
    consonants.push(consonant.name)
  end
  puts "\t\t consonants: #{consonants},"
  words = []
  player.get('language').words.each do |word|
    words.push(word.spelling)
  end
  puts "\t\t words: #{words},"
  puts ""
  puts "\t\t~arg.\t~\#arg1,arg2..."
  puts ""
  puts "\tor take a hit to your ego in silence. ~no"
  puts ""
  puts "\tor read the dictionary. ~-read"
  puts "\t\t this will give you \*+2\* vocabulary, and a new \*vowel/cons/word\*"

  puts "\n..you can always also quit, any time :)\n\n"
end

def is_a_player_opt(opts,arg)
  puts "the opts: #{opts}"
  opts.each do |opt|
    print "  #{opt}"
    if opt.include?(arg)
      puts "UTTVOAUSVDAVOEGVKAJVFKUEVFUVuyv"
      return true #FINDS IT, DOES NOT RETURN AND REGISTER PROPERLY!!! ???
    end
  end

  return false

end

def make_player_opt(language)
  player_opt = []
  language.vowels.each do |vowel|
    player_opt.push(vowel.name)
  end
  language.consonants.each do |consonant|
    player_opt.push(consonant.name)
  end
  language.words.each do |word|
    player_opt.push(word.spelling)
  end
  return player_opt
end

def run_game(player,ai)
  prompt = ')> '
  puts "running game"
  vowel =  ai.calc_next_move(" ")
  puts "ai decided that '#{vowel}' would do"
  ego_dead = 0
  arg_result = ""
  player_won = false
  player_opt = make_player_opt(player.get('language'))
  #THE CORE LOOP!
  while player.get('ego') != ego_dead && ai.get('ego') != ego_dead
    print "counter argument?", prompt
    arg = $stdin.gets.chomp
    puts "the arg: #{arg}"
    case arg
    when is_a_player_opt(player_opt,arg)      #TODO these two!
      puts "IT WAS ACTUALLY A THING"
      arg_result = "You're sending #{arg}!"
    when "no"
      arg_result = "ok.."
    when "-h"
      print_player_info(player)
      next
    when "-read"
      arg_result = "\*learning shit\*\n\t..updating player opts.."
    when "quit"
      puts "LOL, quitter!"
      exit(0)
    when !is_a_player_opt(player_opt,arg)      #TODO these two!
      arg_result = "what was that??"
      puts "CAUGHT A THING!!"
    else
      puts "no cheating!"
      next
    end
    puts arg_result
    if false #arg_result -> ai_ego = 0
      player_won = true
      return
    elsif false #arg_result -> player_ego = 0
      return
    else #new round
      puts "\*ai thinking\*"
      ego_dead += 1
      puts "count : #{ego_dead}"
      arg_result = ""
    end
  end

  #GAME OVER

  #if won
  #puts "YEY!!! WE KNEW IT! OF COURSE YOU CONVINCED THE OPPOSER!"

  #if lost
{'fraction_non_alphanumeric': 0.14544743021132273, 'fraction_numerical': 0.0020871380120010435, 'mean_word_length': 3.266555370061213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2936786', 'n_tokens_mistral': 2810, 'n_tokens_neox': 2783, 'n_words': 690}