Pairing Combinations of an 8-player/team round-robin

514 Views Asked by At

I potentially want to write code for a 8-player/team round-robin tool that allows you to use any combination of schedule (e.g. select from various drop downs). The problem is I don't understand one complicated part.

I'll use an example to explain what I want to find:

Match Day 1

A vs B
C vs D
E vs F
G vs H

Simpler parts

  • The match days themselves can be in any order. A vs B, C vs D, E vs F, G vs H labels the starting pairings as a reference for the later match days.
  • The pairings within a match day can be any order: e.g. E vs F, A vs B, C vs D, G vs H.
  • The players/teams in the pairing can be written the other way around, e.g. A vs B could be B vs A.

Complicated part

If I however swapped 2 pairings between say match day 1 and another match day, what are the ways that can be done?

If you have A vs B, C vs D, E vs F, G vs H as the first match day in 1 combination, you can swap out E vs F, G vs H for E vs G, F vs H or for E vs H, F vs G (2 additional combinations). Since this is a round robin of 8, there's 7 match days, so you could swap (2 ways) between 2, 4 or 6 match days, or swap (3 ways) between 3 or 6 match days. What is the best way to list all these combinations down?