Rename folder 'great12' by '2-great12'.

This commit is contained in:
vonavi
2013-11-19 14:36:21 +02:00
parent ed9b25d8e7
commit 5ec3216af6
124 changed files with 0 additions and 0 deletions

46
2013/2-great12/roundrobin.py Executable file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/python2
# -*- coding: utf-8 -*-
def roundRobin(units, sets=None):
""" Generates a schedule of "fair" pairings from a list of units """
if len(units) % 2:
units.append(None)
count = len(units)
sets = sets or (count - 1)
half = count / 2
schedule = []
for turn in range(sets):
pairings = []
for i in range(half):
pairings.append((units[i], units[count-i-1]))
units.insert(1, units.pop())
schedule.append(pairings)
return schedule
# LOR sheduler
players = [
"HunOL",
"snoopcat",
"Michkova",
"trex6",
"Komintern",
"William",
"J",
"shell-script",
"Zodd",
"raven_cler",
"aptyp",
"Debasher"
]
tour_count = 0
# Generate LORCODE for pairings.
# Also generate "reversal" for autumm season.
for pairings in roundRobin(players):
tours = (len(players) - 1) * 2
tour_count = tour_count + 1
print "[b]Тур" + str(tour_count) + "[/b]"
print "[list]"
for pair in pairings:
print "[*][user]" + pair[0] + "[/user] играет против [user]" + pair[1] + "[/user]"
print "[/list]"