Permutation of sort ... creating team proposals
Mike C. Fletcher
mcfletch at rogers.com
Sat Aug 24 12:50:13 EDT 2002
Here's a simple algo that gives you balanced teams (using skill as the
sort all players into levels by experience level
for each level
for each player
if current_skill of team1 =< current_skill of team2
add to team 1
add to team 2
i.e. aggregate skill will always be fairly close to balanced, but player
numbers may vary considerably if you have a wide gap between experience
levels (so, for instance, my friends Alexei, Shane and I playing newbies
would always be split across two teams, but one of us would be hampered
with up to 5 mewling newbies and would lose horribly as those newbies
were used as BFG fodder by the other team :) ).
The basic approach here is, fit the hard-to-fit items first (large skill
ratings), then fit in the less bulky ones, then the "filler" items.
To get permutations, you shuffle the levels before you run the algo.
Note, however, that this leaves all your teams basically having the same
"balanced design", a few strong players, a few medium players, and a few
weak players. For fun gameplay, it's often nice to have teams such as 2
or 3 strong players versus all the medium and weak players (who get a
charge out of killing the strong players once in a while, and get a lot
of work on their cooperation etceteras), or strong+weak versus medium.
Of course, those balances normally arise from challenges among players,
so not as much point auto-creating them.
Thomas Weholt wrote:
> I've planned to host a lanparty soon and want help to determine what teams
> we should go with. We need two teams and I've put together a list of players
> and given each a rating of experience from newbie to hardcore with some gray
> areas inbetween. Now I'd like to use python to generate team proposals,
> using all players, each team balanced both in terms of experience and number
> of players.
> Take this list :
> players = [('thomas', 5), ('john', 4), ('joe', 3), ('gary', 4'), ('jonas',
> 2), ('eirik', 1), ('anders', 5), ('rune', 5), ('shirley', 2), ('jedi', 3) ]
> Rating goes from 1 = newbie to 5 = hardcore. Each team should have aprox.
> equal number of players and equal sum of experience, but number of players
> may vary if sum of experience stays the same.
> How can I use python generate some team-proposals ?? I was thinking of using
> some sort of permutation, but cannot get the hang of it. Haven't even got
> one line of code to show you.
> Any help you might have would be highly appreciated.
> Best regards,
Mike C. Fletcher
Designer, VR Plumber, Coder
More information about the Python-list