No commit activity in last 3 years
No release in over 3 years
Round Robin Tournament schedule for competitions or classroom teams
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.5
>= 0
 Project Readme

Gem Version Build Status

Round Robin Tournament

This little ruby gem implements the Round Robin Tournament scheduling. It is useful when you want a competition "in which each contestant meets all other contestants in turn", or if you have a classroom of students and want them to work in pairs, but with a different partner every day.

Installation

Add this line to your application's Gemfile:

gem 'double_round_robin_schedule'

And then execute:

$ bundle

Or install it yourself as:

$ gem install double_round_robin_schedule

Usage

require "double_round_robin_schedule"

# Compute all the possible teams for each day in the classroom
playing_teams = %w(team1 team2 team3 team4)
matches = DoubleRoundRobinSchedule.schedule(playing_teams)

# Print for each day, each team
matches.each_with_index do |day, index|
  day_teams = day.map { |team| "(#{team.first}, #{team.last})" }.join(", ")
  puts "Day #{index + 1}: #{day_teams}"
end

# Day 1: (team2, team4), (team3, team1)
# Day 2: (team3, team4), (team1, team2)
# Day 3: (team1, team4), (team2, team3)

Contributing

  1. Fork it ( http://github.com/nithinstany/double_round_robin_schedule/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request