Permutation of sort ... creating team proposals
anton at vredegoor.doge.nl
Sun Aug 25 05:32:55 CEST 2002
On Sat, 24 Aug 2002 15:51:30 GMT, "Thomas Weholt" <2002 at weholt.org> 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
>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.
These kind of puzzles are a hobby for me! I have put together some things I
wrote some time ago and used them to tackle this. Since its been put together
a bit hastily I can't guarantee that its bugfree but at least it could get you
started. If there's a bug I would like to know ...
More information about the Python-list