How to create optimized tournament table

Hi there,

stupid as I am I promised a friend of mine to program something to get her an optimized tournament table for some card game.
I found out that this isn't nearly as easy as I thought, so maybe you have "the idea" that helps me along.

The rules that apply are:
0. Given k participiants and l tables (l = k div 4), each participant has to play WITH each other participant AND he has to play AGAINST each other participant as well, with the absolute number of games played being minimal and fair (i.e., don't have one player playing 10 games while another has to play only 4).
1. Each table has exactly four players per round (but players can be moved to other tables each round).
2. On each table, two players (determined by seating arrangement) play against the other two players - let's define ABCD as "(A with B) against (C with D)".

So far, I have written an algorithm that finds each possible permutation for the players, eliminating "senseless" encounters (i.e., A has already played with B, against C, against D, B has already played against C, against D, C has already played with D - but not necessarily all in the same round).
What is left now is that I need to
- evenly distribute these permutations (i.e., right now because I have some for-statements, player 0 plays more games than player 1 etc, with player k-i for some small i playing the (numerically) necessary number of games)
- and distribute the permutations onto those l tables without collisions (player 0 can play at table 0, but not at table 1 in the same round etc.).

If you have any ideas (or if you want to see the source code I've created so far) plz let me know.




  • First of all, you are interested in the combinations of the players, not the permutations. (Although from what you described, you seem to have actually calculated the combinations) The equation for the number of combinations is N! / {K! * (N-K)!} where N is the total number of players to arrange, and K is the number of players to arrange.

    Randomly assign the players to tables so that there are 4 players per table. In each game, you eliminate two of the possible combinations (1 for each team). With 4 players, there are only 3 possible ways to for there to be two teams, none overlapping (A&B, A&C, or A&D playing against C&D, B&D, or B&C). If you count how many times each player plays a game, they are all equal.

    The interesting part of this is that you said players can move from table to table. What you need to do is only allow the players to move once they have played against all the players on their own table. At that point, take every set of 4 tables, and redistribute the tables, so that each new table has one player from each of the old tables. You then play 3 more rounds, and repeat the process, this time redistributing so that each new table has a new player from each of the second set of tables, with no two players ever having been on the same table. Continue this twice more (so that all possible arrangements have been made) and then move up a level to do 16 tables. Continue until all the tables have been completely scrambled.

    You should note that it will take a large number of games to have everyone play everyone both with and against. After you mix 4 tables, you mix 16, then 64, then 256, etc... and if you have a large number of players, they will not want to play that many games of anything. What you should consider doing is having the tables grouped into sets of 4. From each set of 4 tables, 4 players advance to the next level. This level consists of the 16 best players from 16 tables in round 1. Repeat this process until there are only 16 players left in the game, at which point you can hold your final round. (Or, you can pick the best 4 players again, and have a 1-table round to determine the best of these 4 players.)

    I hope this helps.

    There are two methods in software design. One is to make the program so simple, there are obviously no errors. The other is to make it so complicated, there are no obvious errors.

  • : I hope this helps.

    It does!
    Thanks a lot.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!