Permutation of sort ... creating team proposals
tjreedy at udel.edu
Sat Aug 24 18:34:55 CEST 2002
"Thomas Weholt" <2002 at weholt.org> wrote in message
news:6YN99.13411$sR2.251227 at news4.ulv.nextra.no...
> I've planned to host a lanparty soon and want help to determine what
> we should go with. We need two teams and I've put together a list of
> and given each a rating of experience from newbie to hardcore with
> areas inbetween. Now I'd like to use python to generate team
> using all players, each team balanced both in terms of experience
> of players.
> Take this list :
> players = [('thomas', 5), ('john', 4), ('joe', 3), ('gary', 4'),
> 2), ('eirik', 1), ('anders', 5), ('rune', 5), ('shirley', 2),
('jedi', 3) ]
> Rating goes from 1 = newbie to 5 = hardcore. Each team should have
> equal number of players and equal sum of experience, but number of
> may vary if sum of experience stays the same.
> How can I use python generate some team-proposals ?? I was thinking
> some sort of permutation, but cannot get the hang of it. Haven't
> one line of code to show you.
> Any help you might have would be highly appreciated.
A program can only do what you could do mentally or with pencil and
paper or calculator. What you did not say is how you plan to choose
from proposals. If you are going to just choose, just go ahead and
make up the teams. If you want a random choice, make up one team,
then switch around to make 5 variations, put each proposal on a
numbered card, and have someone roll a die to select. Here is one
proposal about as balanced as possible.
thomas, rune, jedi, joe, eirik
anders, john, gary, jonas, shirley
Hope you all have fun.
More information about the Python-list