RRSchedule

A ruby gem that makes it easier to generate Round-Robin schedules

            gem install rrschedule
            require 'rrschedule'
            schedule=RRSchedule::Schedule.new(
              :teams => %w(T1 T2 T3 T4 T5 T6 T7 T8),
              :rules => [
                RRSchedule::Rule.new(
                  :wday => 3,
                  :gt => ["7:00PM","9:00PM"],
                  :ps => ["field #1", "field #2"]
                )
              ],
              :start_date => Date.parse("2010/10/13")
            ).generate

            #human-readable schedule
            puts schedule.to_s

            #just the round-robin
            puts schedule.rounds.collect{|r| r.to_s}

            #Or, if you want to loop through the schedule...
            schedule.gamedays.each do |gd|
              puts gd.date
              gd.games.each do |game|
                puts "#{game.team_a} Vs #{game.team_b}"
                #...
              end
            end
          
See github page for more info.

gem written by Fran├žois Lamontagne | blog | My Freelancer Website