5

I am building a small website for volleyball (personal interest). Appreciate help in algorithm for scheduling the games such that

  1. It can work for arbitrary number of teams and groups. Round-robin within each group. So if there are 6 teams in a group then there will be a total of 15 games in that particular group.
  2. A game lasts for 30 mins
  3. The schedule is evenly distributed i.e. a team is not required to play consecutively
  4. Each team is playing in approx equally distributed intervals i.e. a team shouldn't play their 1st game at 8 AM and wait until evening for their next 2 games
  5. We can schedule games starting from 8 AM until 4 PM.

6 teams is just an example. I am looking for a general algorithm that works for arbitrary number of teams, courts and groups.

Regards.

Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327

2 Answers2

1

I'm not sure this needs an algorithm. Since it's round robin with a fixed number of teams and games, you can really just set up a schedule (same on both courts).

Let me explain and tell me if you need something more.

There will be 15 games, with each team playing each other team so each team plays 5 games. You can run the tournament by playing 5 sets of 3 games where each team plays once in each set.

Example:

1-2
3-4
5-6

1-3
2-5
4-6

3-5
1-4
2-6

1-5
2-4
3-6

4-5
1-6
2-3

The longest interval possible for any team between games is 4 slots (2 hours). No team will play two consecutive games. Just plug the team names in and go.

Total playing time is 7.5 hours which just fits within your 8am-4pm window.

Note: I just put this together quickly. It may be possible to re-order things so that the longest interval is actually 3 games, not 4 without sacrificing the no-consecutive-game rule. As it stands, only one team goes the max interval (team 3 between sets 3 and 4). If that matters, it's worth looking into, but practically speaking, I think this would be fine.

nycdan
  • 2,819
  • 2
  • 21
  • 33
  • +1 Thank you but 6 teams is just an example. I am looking for a general algorithm that works for arbitrary number of teams, courts and groups. – Aravind Yarram Sep 07 '11 at 04:12
  • Ah, that wasn't clear. Okay, will look at that. But if multiple courts will all run separate groups the same way, the number of courts really doesn't matter, does it? Or is that not always true? – nycdan Sep 07 '11 at 04:15
  • Did you look at this? http://stackoverflow.com/questions/1037057/how-to-automatically-generate-a-sports-league-schedule The wikipedia article referenced shows the logic behind how to code it quite nicely – nycdan Sep 07 '11 at 04:20
1

The simpliest form of fixturing is using the berger table. Check out the calculation on this page http://en.wikipedia.org/wiki/Round-robin_tournament

If you wanted to save yourself the effort, you could try out http://www.fixionline.com which does all the hardwork for you. It also integrates with your website to show match times, ladders and results.

Maxim Gershkovich
  • 45,951
  • 44
  • 147
  • 243