Side note: so far neither Bard nor ChatGPT has managed to do this correctly, even when I show the errors.


I have 4N players ( N = 4 or N = 5 suffices) and want to set up three rounds of play. In each round, there will be N games played (four players per game). I want to set up the groupings so that no two players appear together more than once, regardless of whether they are teammates or not.  

Is there a reasonably simple non-exhaustive search algorithm that will set up these rounds for me?  

The first round, of course is easy:  

(16 players, each row is the players in one game)  

1,2,3,4  

5,6,7,8  

9,10,11,12  

13,14,15,16  

To clarify: in a given round, every player is in one of the foursomes. All games (foursomes) are played simultaneously in a given round.


So in the second round, player 1 must not be in the same game as any of 2,3,4 ;and so on. I can't tell whether the [Hungarian](https://en.wikipedia.org/wiki/Hungarian_algorithm) or [Round Robin](https://en.wikipedia.org/wiki/Round-robin_item_allocation) algos can't do this or just that the "AI" software can't do it correctly.


**Another thought**
Based on an external suggestion; not sure this holds in all cases.  

First divide the players into two equal sets. It's relatively easy to create unique pairs for the rounds in each of these "brackets." Then any combination of pairs from BracketA with pairs from BracketB will yield the groups of four that I'm looking for. Is this valid?



Optimal algorithm for a "round robin" doubles tournament?
For $N=5$ and more generally $N$ relatively prime to $6$, it is easy to make $N$ rounds.


Name the players $(i,j)$ for $0 \leq i \leq 3$ and $0 \leq j \leq N-1$. In the $a$-th round, take the elements of the $b$-th quadruple to be $\{ (0,b \bmod N), (1,a+b \bmod N), (2, 2a+b \bmod N), (3, 3a+b \bmod N) \}$.


Suppose, to the contrary that $(i\_1, j\_1)$ and $(i\_2, j\_2)$ play together in both rounds $a$ and $a'$. Since $(i,j\_1)$ and $(i,j\_2)$ never play in the same round, we must have $i\_1 \neq i\_2$. Then the equation that $i\_1$ and $i\_2$ play together in round $a$ says that $j\_1 - a i\_1 \equiv j\_2 - a i\_2 \equiv N$ and, likewise, $j\_1 - a' i\_1 \equiv j\_2 - a' i\_2 \bmod N$. So $(a-a') (i\_1 - i\_2) \equiv 0 \bmod N$. But $i\_1 - i\_2 \in \{ \pm 1, \pm 2, \pm 3 \}$ and $\text{GCD}(N,6)=1$, so this implies that $a=a'$. $\square$




---


A more pictorial description. I'll use bridge instead of tennis, because the 4-sides of a table make for good nomenclature. Arrange $N$ bridge tables in a cricle. At each of $N$ tables, let one player sit at north, one at east, one at south and one at north.


After the first set of games, the north players stay put, the east players move on one table, the south players move on two tables and the west players move on three table, each staying in their same position (north, east, west or south). Repeat this $N$ times.


