在国际象棋锦标赛中使用了一个非常简单的系统,称为循环赛。
这个想法是将玩家分成桌子的两侧。其中一名玩家被指定为“中心”(为了更好的词)。比赛开始时让球员面对面比赛。在第一轮之后,除了轮毂之外的每个人都向前移动一把椅子,然后切换白色/黑色(运动中的主场/客场)顺序。当球员坐在原来的地方时,整个循环比赛都结束了。如果你想让每个人都玩两次,那就再做一次。
带有实现细节的维基百科文章。
在您的特殊情况下,我会尝试一次包括所有团队的循环赛。然后你为每个分区做一次相同的事情,并确保分区内的球队在主场和一次客场比赛中互相比赛,从第一轮循环赛中检查球队在该轮比赛中的表现。
当然,这样做的不利方面是,您将在锦标赛结束之前参加所有分区间的比赛(因为最后的 n-1 场比赛是针对分区内的球队 [n=分区内的球队数])。如果这是一个问题,您可以简单地交换一下匹配项。
我实际上编写了一个简单的 Python 脚本来执行此操作。它不需要很多代码行,并产生了相当不错的结果。这将创建一个时间表,其中每支球队在他们的分区中与每个球队比赛两次,一次与其他分区的球队比赛。但是,没有检查以确保团队以同一团队在家的方式相遇两次。但是这段代码应该很好地了解如何创建自己的调度代码。
#!/usr/bin/python
div1 = ["Lions", "Tigers", "Jaguars", "Cougars"]
div2 = ["Whales", "Sharks", "Piranhas", "Alligators"]
div3 = ["Cubs", "Kittens", "Puppies", "Calfs"]
def create_schedule(list):
""" Create a schedule for the teams in the list and return it"""
s = []
if len(list) % 2 == 1: list = list + ["BYE"]
for i in range(len(list)-1):
mid = int(len(list) / 2)
l1 = list[:mid]
l2 = list[mid:]
l2.reverse()
# Switch sides after each round
if(i % 2 == 1):
s = s + [ zip(l1, l2) ]
else:
s = s + [ zip(l2, l1) ]
list.insert(1, list.pop())
return s
def main():
for round in create_schedule(div1):
for match in round:
print match[0] + " - " + match[1]
print
for round in create_schedule(div2):
for match in round:
print match[0] + " - " + match[1]
print
for round in create_schedule(div3):
for match in round:
print match[0] + " - " + match[1]
print
for round in create_schedule(div1+div2+div3):
for match in round:
print match[0] + " - " + match[1]
print
if __name__ == "__main__":
main()