Code works fine except...

John Yeung gallium.arsenide at gmail.com
Wed May 6 00:36:12 EDT 2009


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.)

John



More information about the Python-list mailing list