Weighted choices

Oscar Benjamin oscar.j.benjamin at gmail.com
Tue Sep 10 06:27:45 EDT 2013


On 10 September 2013 03:27, Jason Friedman <jsf80238 at gmail.com> wrote:
>>
>> OK, you're well inside the "finite" domain. Also, you probably want less
>> than the "natural" randomness. I'd probably shuffle the potential
>> quarterbacks and the others in independent lists, and then pick one half of
>> each to form a team. The other half would play in the next game.
>> Additionally you can keep track of every player's total number of games and
>> games not played in a row, and apply a correction if either exceeds a limit
>> acceptable for a kid.
>
> PIcking half to play one game and half to play the other is not an
> option.  For one, there really isn't a concept of half when a variable
> number of players are available on a given Saturday.  For two, we
> could have an unexpected absence, or during the game an injury.  For
> three, the parents paid to have their child play in the league, and
> the league runs until the end of October, not long enough for that
> strategy to work out.

Don't take the "pick half" idea so literally. Look at it a different
way: attempt to form a team from all the players who didn't play in
the last game. If that group of players isn't enough to form a team
then they're all in the team and the remainder is chosen randomly from
those that did play in the last game. Here's a concrete example:

Dave hasn't played for 3 games
John, Bob and Steve haven't played for 2 games
Baz, Joe and Tom haven't played for 1 game
James and Tim played the last game.

Those are all the players that could make it on Saturday but you need
to choose 6. You want either of Bob or Tim for quarterback. Bob hasn't
played for longer so you choose him. Obviously Dave's in because he
hasn't played for longer than everyone else. That's not enough for a
team though so you'll need John and Tom as well. That makes 4 so you
need 2 more. However there are three players left that didn't play in
the last game. At this point you put their three names in a hat and
draw out 2 giving Baz and Tom. So Joe has to sit this one out but he's
pretty much definitely in the next game.

Rather than drawing names out of a hat, you could use the total number
of games played as a tiebreaker and only resort to coin-flipping or
whatever when you get a tie for that as well. You could do the same
for quarterback selection as well but based on how often they've been
quarterback and then how many games they've played and then flip a
coin. This algorithm is not really that random but since it depends on
who's available on what day it will probably jumble up the teams over
time at the same time as being broadly fair to each of the children.

For the quarterbacks you'll always be picking the ones that played
least recently so as long as your quarterback pool is oversized in
proportion to the number of players they'll end up playing as much as
everyone else. i.e. if a team has 1 quarterback and 5 players then
your total quarterback pool should be more than 1/5 of the total
player pool (this is also probably necessary to guarantee having a
quarterback anyway).


Oscar



More information about the Python-list mailing list