Skip to content

Commit

Permalink
Created match schedule script
Browse files Browse the repository at this point in the history
  • Loading branch information
codingpains committed Aug 23, 2010
1 parent 2a8dc81 commit da955c6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tournament-sheduling.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def round_robin(teams = [])
matches = []

teams.each do |team|

oposing_teams = teams
teams.delete team

for oposing_team in oposing_teams
match = "#{team} vs #{oposing_team}"
matches << match unless matches.include? match || matches.inlcude?("#{oposing_team} vs #{team}")
end

end

matches.shuffle
end

puts round_robin(ARGV)

0 comments on commit da955c6

Please sign in to comment.