Code works fine except...

MRAB google at mrabarnett.plus.com
Wed May 6 09:29:41 CEST 2009


John Yeung wrote:
> On May 5, 11:37 pm, Ross <ross.j... at gmail.com> wrote:
> 
>> On May 5, 10:33 am, MRAB <goo... at mrabarnett.plus.com> wrote:
>>
>>> Here's my approach (incomplete):
>> FYI... I was testing your code further and discovered a strange
>> outcome... when there are 16 people for 7 courts, every 7th
>> round your code produces 4 byes instead of the correct 2 byes.
> 
> Well, MRAB did say his was incomplete, and it's significantly shorter
> and cleaner than mine.
> 
> Mine has even weirder-looking behavior at 16 players on 7 courts, but
> I think it's because mine tries harder to keep things balanced.  After
> a few rounds, the inequalities start to build up, and my routine picks
> some people more often to "catch up", but it doesn't prevent the same
> person from being scheduled for multiple matches the same week.  There
> may also be other, more subtle ways mine is broken.
> 
> It also may be that the problem is inherently unsolvable for some
> values.  (I'm still waiting for someone with sufficient math ability
> to swoop in and either provide a way that works for all values, or
> confirm that there are just some unavoidable pathological cases.)
> 
I'm not sure that all the requirements can be met.

I have the feeling that if the number of rounds is restricted then the
difference between the minimum and maximum number of byes could be 2
because of the requirement that players shouldn't play each other more
than once, meaning that the players have to be shuffled around a bit, so
a player might play a week earlier or later than would otherwise be the
case.

If every possible combination is done (everyone plays everyone else)
then the number of byes would be the same for all, otherwise the
difference could be 2, not 1. I think! :-)



More information about the Python-list mailing list