Trying to calculate matches in a tournament using combinations, in games that have multiple players

439 Views Asked by At

I am trying to calculate opponents in matches for my app game.

In it I will have a league of a varied number (between 5-14) of players and I want to know, given the number of players in a league, what's the smallest number of games each person can play so they've played all other people in the league and equal number of times. I could obviously play out every combination, but I want to play less games if possible. Each match will have either 3 or 4 players in it (including yourself)

Some examples to help better explain...

I know that in a 9 player league, if each match has 3 opponents only, then each player can play only 8 games, resulting in playing each opponent twice. This is fewer than the full 84 possible combinations.

In an 8 player league with 4 people then it only needs 7 games per person playing each opponent 3 times.

I THINK I have worked out the maths on how to do get the number of matches and number of times to play each opponent, but I can't work out how to come up with the combinations of players in order to satisfy this.

I can add the maths I've worked out, but it would be quite long so I'll only do that if people need it. As that's not actually the bit I need solving. (though it's part of the solution)

I've tried both on pen and paper, and writing a program to do it. The program has had the most success, working on a variety of combinations of league and match size, but it doesn't work on all of them.

I'm at a loss right now, and looking for any sort of help.

2

There are 2 best solutions below

1
On

Organize it in some way and then look for a systematic method.

Nine players with three in each game:

1:2:3 1:4:5 1:6:7 1:8:9
2:4:6 2:5:8 2:7:9
3:4:9 3:5:7 3:6:8
4:7:8
5:6:9
0
On

After @Saulspatz told me what to look for, (BIBD) I found a library in the R language that worked it out for me.

https://rdrr.io/cran/crossdes/man/find.BIB.html

@Saulspatz if you want to mark up a quick answer talking about balanced incomplete block designs I'll give you a tick