Permutation of sort ... creating team proposals

Thomas Weholt 2002 at weholt.org
Sat Aug 24 11:51:30 EDT 2002


Hi,

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,
Thomas





More information about the Python-list mailing list