Created
July 9, 2015 16:53
-
-
Save micti/672ab3babf83304f9d70 to your computer and use it in GitHub Desktop.
Elimination Tournament - Seed Order for 1st Round
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
# Elimination Tournament | |
# Seed Order for 1st Round | |
# Examples: | |
# 1 4 3 2 or 1 8 5 4 3 6 7 2 | |
# total : number of compitetor | |
def draw_et_seed(total): | |
round = 1 | |
max = 2 | |
while (max < total): | |
max *= 2 | |
round += 1 | |
result = [0, 1, 2] | |
temp = [0, 1, 2] | |
round_total = 2 | |
for i in range(2, round + 1): | |
round_total *= 2 | |
result = [] | |
result.append(0) | |
for j in range(2, round_total + 1, 2): | |
k = j / 2 | |
if k % 2 == 0: | |
result.append(round_total + 1 - temp[k]) | |
result.append(temp[k]) | |
else: | |
result.append(temp[k]) | |
result.append(round_total + 1 - temp[k]) | |
temp = result | |
print(result) | |
draw_et_seed(34) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment