EdFred
Taxi to Parking
...running out of valid available spaces.
How would you tackle this?
So I've been tasked with running "brackets" in an upcoming bowling tournament. Each bracket is a pod which is a single elimination tournament that has 8 entrants in it and advancing in the bracket is based on their 3 game scores. A bowler may enter as many brackets as they like. A bowler will only be entered into a single bracket once (i.e. he/she can't bowl against him/herself inside a bracket)
These numbers are just for testing right now as the actual numbers will change.
I have 50 bowlers and each one may enter between 1 and 8 brackets.
I have 233 total entries - which breaks down to 30 brackets with 7 "bye" slots. (233 mod 8)
Here's how I've tested assigning without having to tweak in manually:
Start with first bowler
Pick random number 1 - 30 (bracketID)
if n < 8 and bowlerID isn't present in that bracketID
assign to bracket
else
repick random 1-30 and try again
do this for the number of entries each bowler has
So this works - almost - until I get to the end.
My last bowler has 8 entries, but by the time the code gets there there are only 5 brackets with available spaces - although multiple spaces in each bracket - but you can't have duplicate entries.
What method would you use to fill these pods? - also keep in mind that I don't want duplicate pods where all the bowlers are the same in multiple pods. (i.e. bowlers 1-8 are all in pods 1,2,3,4)
How would you tackle this?
So I've been tasked with running "brackets" in an upcoming bowling tournament. Each bracket is a pod which is a single elimination tournament that has 8 entrants in it and advancing in the bracket is based on their 3 game scores. A bowler may enter as many brackets as they like. A bowler will only be entered into a single bracket once (i.e. he/she can't bowl against him/herself inside a bracket)
These numbers are just for testing right now as the actual numbers will change.
I have 50 bowlers and each one may enter between 1 and 8 brackets.
I have 233 total entries - which breaks down to 30 brackets with 7 "bye" slots. (233 mod 8)
Here's how I've tested assigning without having to tweak in manually:
Start with first bowler
Pick random number 1 - 30 (bracketID)
if n < 8 and bowlerID isn't present in that bracketID
assign to bracket
else
repick random 1-30 and try again
do this for the number of entries each bowler has
So this works - almost - until I get to the end.
My last bowler has 8 entries, but by the time the code gets there there are only 5 brackets with available spaces - although multiple spaces in each bracket - but you can't have duplicate entries.
What method would you use to fill these pods? - also keep in mind that I don't want duplicate pods where all the bowlers are the same in multiple pods. (i.e. bowlers 1-8 are all in pods 1,2,3,4)
Last edited: