This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_balanced_round_robin(players): | |
""" Create a schedule for the players in the list and return it""" | |
s = [] | |
if len(players) % 2 == 1: players = players + [None] | |
# manipulate map (array of indexes for list) instead of list itself | |
# this takes advantage of even/odd indexes to determine home vs. away | |
n = len(players) | |
map = list(range(n)) | |
mid = n // 2 | |
for i in range(n-1): |