0
$\begingroup$

I am trying to create a round-robin bracket generator for a game where each match contains three teams competing against each other (1v1v1) given the teams, rounds, and rooms in Python. I don't believe this is a programming question, as I need to know how to go about creating the bracket.

Specifically, I have 36 teams (split evenly between 2 divisions), 12 rounds, and 7 rooms (concurrent matches/round).

It should be as fair as possible. My criteria have been that every team plays the same number of rounds (+/- 1) and that no teams compete each other more than once.

The output should be something like:

*This is not fair. Team names here are first letter of division then team letter.

(Red or Green) + (A through R)

Room Round 1 Round 2 Round 3 Round 4 ...
A RA v RJ v RN RF v RI v RP RD v RE v RF RJ v RO v RR ...
B RH v RO v RP RC v RG v RH RC v RO v RQ RF v RI v RP ...
C RD v RI v RK RB v RM v RN RA v RG v RP RD v RG v RQ ...
D GA v GG v GL GB v GK v GM GF v GL v GP GF v GH v GJ ...
E GF v GN v GR GA v GI v GP GD v GM v GR GD v GN v GO ...
F GC v GI v GK GE v GO v GR GA v GE v GN GA v GK v GR ...
G GC v GI v GK GE v GO v GR GA v GE v GN GA v GK v GR ...

I'm not a mathematician, but I'm willing to learn what I need to. That said, I'm in 11th grade. My highest level math class so far is HS Pre-Calc.

If this is the wrong place, my apologies. Can you point me to the right one?

Edit:

Correct, the divisions do not compete with each other.

I've tried several implementations. They all were some kind of brute force attempt. My hardware is decent. I tried adding threading before leaving it overnight. I added debugging to ensure it wasn't getting stuck and it didn't seem to.

  1. get all combinations of 3 teams (python has itertools.combinations for this)
  2. pick a random one
  3. test to see if it broke the schedule (made teams play each other twice or the same team in different rooms of the same round)
  4. If not add it to the schedule and repeat 2-4

The problem with brute force:

From 36 teams choose 3

  • $_{36}{nCr}_{3} = 7140$

From combinations, choose 84 (7 rooms * 12 rounds) matches

  • $_{7140}{nCr}_{7*12} \approx 9.5 E+196$ possibilities

MathJax has a bit of a learning curve, apparently... Sorry if the equations arn't clear.

I said the table above wasn't fair because I duplicated the 6th row to have 7 because I havn't been able to account for the number of rooms being indivisible by the number of divisions.

$\endgroup$
6
  • $\begingroup$ Presumably teams in each division can only play against each other? $\endgroup$
    – Calvin Lin
    Commented May 24, 2023 at 3:21
  • $\begingroup$ Can you explain why your current setup isn't "fair"? Can you explain how you created your current setup? $\endgroup$
    – Calvin Lin
    Commented May 24, 2023 at 3:22
  • 1
    $\begingroup$ I think it should be possible to essentially cut the problem in half, since we never have inter-divisional play. However we approach the problem, we can solve each division separately under the assumption that each division gets 4 rooms for 6 rounds and 3 rooms for the other 6 rounds. $\endgroup$ Commented May 24, 2023 at 15:14
  • $\begingroup$ Ok, makes sense. $\endgroup$
    – Jon
    Commented May 24, 2023 at 15:27
  • $\begingroup$ Generally, brute force exclude random. So your step 2 should not be 'select a random one' but 'select all convenient ones' $\endgroup$
    – Lourrran
    Commented May 24, 2023 at 15:35

0

You must log in to answer this question.

Browse other questions tagged .