On May 4, 7:01 am, Ross <ross.j...@gmail.com> wrote: > On May 3, 10:16 pm, John Yeung <gallium.arsen...@gmail.com> wrote: > > > > > On May 3, 11:29 pm, Chris Rebert <c...@rebertia.com> wrote: > > > > Probably not the cause of the problem, but where > > > did the magic numbers 1.072 and 1.08 come from? > > > It is perhaps not the most direct cause of the problem, in the sense > > that the magic numbers could take various values and the problem would > > still be there. But the magic numbers appear to be used for > > "spreading out" bye selection, and that's broken. > > > The extended slice as written will always pick the first element, > > since the step is guaranteed to be positive. Since the first player > > (or None, when there are an odd number of players) stays put in the > > first position during the round_robin shuffle, that player will always > > be selected for a bye. > > > Further, as written, the calculated number of byes has no bearing on > > the actual number of byes selected. > > > I think what I would do is adjust the shuffling algorithm in such a > > way that everyone moves through the various positions in the list > > (would it be as simple as adding a shift at the end of > > round_robin???). Then I could simply select the byes from one end of > > the list (with a regular slice instead of an extended slice). > > > John > > The "magic numbers" that everyone is wondering about are indeed used > for spreading out the bye selection and I got them by simply > calculating a line of best fit when plotting several courts: byes > ratios. > > The "byes = #whatever" in my code calculate the number of tuples that > need to be placed in the bye_list. > > At first glance, the suggestion of adding a simple shift at the end of > round_robin doesn't seem to work since round_robin already shifts > everything except for the first position already. Please correct me if > I'm wrong because you might have been suggesting something different.
And also, as you all have pointed out, my inclusion of > def test_round_robin(players, rounds, courts, doubles = False): > players = range(players) > for week in round_robin(players,rounds,courts): should have been > def test_round_robin(players, rounds, courts, doubles = False): > players = range(players) > for week in round_robin(players,rounds): I forgot to erase that extra parameter when I was playing around with my code. -- http://mail.python.org/mailman/listinfo/python-list