Find most varied match assignments for a 4-player card game

64 Views Asked by At

I'm a programmer and confronted with a particularly hard (at least for me) problem I couldn't find an answer for. This is not a school task or anything. It is something I need personally. I've invested a lot of time in it already.

The rules

  • There is a fixed number of players $N \in \mathbb{N}$, where $(N \mod 4) = 0$, i.e. $N$ must be a multiple of 4. Let's denote the set of all players as $P = \{1,...N\}$.

  • For every match, two players play in a team against another team of two players. So a match consists of 4 distinct players.

The problem

  • Find a set of matches $M$, such that every player plays exactly once with every other player (as a team), and

  • do this in such a way that every player plays against every other player exactly two times.

The requirement comes from the desire for the greatest amount of variety for every player.

My observations

There are some observations I already made, such as:

  • There are exactly $\frac{N(N-1)}{2}$ different pairs (unordered).

  • For every match, a player plays with one team mate and against two others, therefore there are $N(N-1)$ face-offs between players. It follows that for a perfect variety, each player has to play against every other exactly two times. I made this into a requirement because of this.

  • The number of matches is $|M| = \frac{N(N-1)}{4}$, so half the number of team pairs.

Already tried

I've done the following so far:

  • Implemented a brute-force algorithm. There are too many permutations for even a small input size. This is not feasible.

  • Tried to formulate it as a dynamic programming problem, but figured that it is not possible. The problem can only be solved globally, and not split into smaller subsets.

  • Tried to come up with some deterministic relationsship between player pairs, such that the requested properties follow automatically. I failed so far.

My questions

  • I wonder if it is even possible that every player plays against every other exactly twice. Maybe that's a false assumption. And if so: Why is it not possible? Also, if it is not, what is the best I can still achieve in terms of variety? At the very least, each player should face-off against every other player at least once.

  • Is there a deterministic procedure that achieves the requirements?