Im trying to write some software for pairing players in card gaming tournaments, each player must play on a table with each other player exactly 1 time, currently there is going to be 25 players with 5 players per table.


Is there an algorithm or even a hard coded solution for this? I can't find anything with google



Round robin with 5 player game
You want to look up tournament design in a field called combinatorial design theory. There is no algorithm for the general case (5k,5,m,) for a tournament having 5k players with each pair meeting m times in a group of 5. However for (25,5,1) there is a design.


Arrange the 25 players in a square, and "play along lines of a torus". Call player 1 the square at (1,1). The first game he plays players horizontal from him (x,1), and similarly all players with same y coordinate sit at the first table. Second game, first player plays (1,y) and all players with same x coordinate play at the same table.


Now do diagonals with offset (1,1) and (-1,1). So third game (1,1) plays with (2,2) and (3,3) and (4,4) and (5,5), while (2,1) plays with (2+1,1+1) and (2+1+1,1+1+1), and so on. Fourth game adds 1 to y and -1 to x, so (1,1) plays with (5,2) and (4,3) and (3,4) and (2,5).


For the last two games, do slant diagonals with offsets (2,1) and (-2,1). So (1,1) and (3,2) share a fifth table and (1,1) and (4,2) share a sixth table, and extend along the slant diagonal on the torus. If you don't know what a torus is, draw the five by five pictures with differing diagonals and see how the players divide into groups of five lines. Because five is a prime p and you have p^2 players meeting in groups of p, you should be able to construct similar designs for (p^2,p,1).


Gerhard "Look Up Projective Planes Too" Paseman, 2019.02.04.


