<commit_before># rrschedule (Round Robin Schedule generator)
# Auhtor: <NAME>
############################################################################################################################
module RRSchedule
  class Schedule
    attr_reader :flights, :rounds, :gamedays
    attr_accessor :teams, :rules, :cycles, :start_date, :exclude_dates,:shuffle

    def initialize(params={})
      @gamedays = []
      self.teams = params[:teams] if params[:teams]
      self.cycles = params[:cycles] || 1
      self.shuffle = params[:shuffle].nil? ? true : params[:shuffle]
      self.exclude_dates = params[:exclude_dates] || []
      self.start_date = params[:start_date] || Date.today
      self.rules = params[:rules] || []
      self
    end

    #This will generate the schedule based on the various parameters
    def generate(params={})
      raise "You need to specify at least 1 team" if @teams.nil? || @teams.empty?
      raise "You need to specify at least 1 rule" if @rules.nil? || @rules.empty?
      arrange_flights
      @stats = {}

      @teams.each do |t|
        @stats[t] = {
          :gt => {},
          :ps => {}
        }

        @stats[t][:gt] = {}
        all_gt.each do |gt|
          @stats[t][:gt][gt] = 0
        end

        @stats[t][:ps] = {}
        all_ps.each do |ps|
          @stats[t][:ps][ps] = 0
        end
      end

      @gamedays = []
      @rounds = []

      @flights.each_with_index do |teams,flight_id|
        current_cycle = current_round = 0
        teams = teams.sort_by{rand} if @shuffle

        #loop to generate the whole round-robin(s) for the current flight
        begin<commit_msg>flatten teams for stats calculation<commit_after># rrschedule (Round Robin Schedule generator)
# Auhtor: <NAME>
############################################################################################################################
module RRSchedule
  class Schedule
    attr_reader :flights, :rounds, :gamedays
    attr_accessor :teams, :rules, :cycles, :start_date, :exclude_dates,:shuffle

    def initialize(params={})
      @gamedays = []
      self.teams = params[:teams] if params[:teams]
      self.cycles = params[:cycles] || 1
      self.shuffle = params[:shuffle].nil? ? true : params[:shuffle]
      self.exclude_dates = params[:exclude_dates] || []
      self.start_date = params[:start_date] || Date.today
      self.rules = params[:rules] || []
      self
    end

    #This will generate the schedule based on the various parameters
    def generate(params={})
      raise "You need to specify at least 1 team" if @teams.nil? || @teams.empty?
      raise "You need to specify at least 1 rule" if @rules.nil? || @rules.empty?
      arrange_flights


      @stats = {}
      @teams.flatten.each do |t|
        @stats[t] = {
          :gt => {},
          :ps => {}
        }

        @stats[t][:gt] = {}
        all_gt.each do |gt|
          @stats[t][:gt][gt] = 0
        end

        @stats[t][:ps] = {}
        all_ps.each do |ps|
          @stats[t][:ps][ps] = 0
        end
      end

      @gamedays = []
      @rounds = []

      @flights.each_with_index do |teams,flight_id|


        current_cycle = current_round = 0
        teams = teams.sort_by{rand} if @shuffle

        #loop to generate the whole round-robin(s) for the current flight
        begin
{'fraction_non_alphanumeric': 0.1978384869408586, 'fraction_numerical': 0.003602521765235665, 'mean_word_length': 2.6021621621621622, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3779983', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1002, 'n_words': 257}