Permutation of sort ... creating team proposals

Terry Reedy tjreedy at udel.edu
Sat Aug 24 12:34:55 EDT 2002


"Thomas Weholt" <2002 at weholt.org> wrote in message
news:6YN99.13411$sR2.251227 at news4.ulv.nextra.no...
> 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.

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.

Terry






More information about the Python-list mailing list