Search code examples
javaalgorithmround-robintournamentsports-league-scheduling-problem

3-way / 4-way round-robin tournament scheduling algorithm


I would like to create/implement a tournament scheduling algorithm which is able to deal with more than 2 participants per game.

The problem seems to be well known for 2 participants. See here for example: Round Robin Algorithm Implementation Java

Example of matchups with 6 teams (A, B, C, D, E, F):

  1. (ABC)(DEF)
  2. (ABD)(CEF)
  3. (ABE)(CDF)
  4. (ABF)(CDE)
  5. (ACD)(BEF)
  6. (ACE)(BDF)
  7. (ACF)(BDE)
  8. (ADE)(BEF)
  9. (ADF)(BCE)
  10. (AEF)(BCD)

In case of an odd number of teams (i.e. A, B, C, D, E), I would like to have a 3-way and a 2-way game per round: (ABC)(DE)

Once the 3-way problem is solved, I would like to do the same with 4-way games.

I am unable to create such an algorithm and unable to find a similar solution on the internet.

Could somebody point me in the right direction?


Solution

  • To choose K items from N, you need combinations.

    Note that C(6,3)=20 but you do fixing one item (A) and have really C(5,2)=10 variants

    There is a lot of implementations of combinations generation - the simplest is recursive, more effective is lexicographic ordered generation -simple C code