I am trying to generate a game schedule where $k$ players at the time, out of $n$ participants, meet in each game, but any player meets another player only once. In each game, with $k$ simultaneous players, the $k$ players compete against each other, there are no multi-player teams.
A 'raw and basic' method for a $(7,3)$-game is shown below, but there must be a more elegant way in Mathematica
. It is not very customisable for a general $(n,k)$-game. TIA.
n = 7;
mat = Table[1, {x, n}, {y, n}];
For[i = 1, i <= n, i++,
For[j = i + 1, j <= n, j++,
For[k = j + 1, k <= n, k++,
If[mat[[i,j]]*mat[[j,i]]*mat[[i,k]]*mat[[k,i]]*mat[[j,k]]*mat[[k,j]] == 1,
p = {i, j, k};
Print [p];
mat[[i,j]] = 0;
mat[[j,i]] = 0;
mat[[i,k]] = 0;
mat[[k,i]] = 0;
mat[[j,k]] = 0;
mat[[k,j]] = 0;
]
]
]
]
Result: {1,2,3}, {1,4,5}, {1,6,7}, {2,4,6}, {2,5,7}, {3,4,7}, {3,5,6}.