I am creating an application that helps manage Frisbee hat tournaments. The idea is that people sign up for this “hat tournament”. When they register, give us a numerical value between 1 and 6, which represents their skill level.
Currently, we take this huge list of people who signed up and manually try to create teams from this based on the skill levels of each player. I decided that I could automate this by creating an algorithm that breaks down the commands as evenly as possible.
The only data that goes into this is the array of “players” and the desired “number of teams”. Generally speaking, we look at 120 players and 8 teams.
My current thinking process is basically to have a “score” for each team. This account is the sum of all the skill levels of the designated players. I go through every skill level. I go through the selection rounds once inside the skill level cycle. The election order is selected in each round based on the assessment of the team.
It actually works pretty well, but its not perfect. For example, in my sample array, I had a range of 5 points. I could very easily manually change the players around and make a difference of no more than 1 pt between the teams .. the problem is that this is done programmatically.
Here is my code: http://pastebin.com/LAi42Brq
Data display fragment:
[2] => Array ( [user__id] => 181 [user__first_name] => Stephen [user__skill_level] => 5 ) [3] => Array ( [user__id] => 182 [user__first_name] => Phil [user__skill_level] => 6 )
Can anyone think of a more efficient, more efficient way to do this? Thank you very much in advance!
source share