Created
March 24, 2014 17:02
-
-
Save fern4lvarez/9744484 to your computer and use it in GitHub Desktop.
kicker tournament for cctrl
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
import random | |
import time | |
backend = ['mk', 'sf', 'tr', 'oh', 'rm', 'tw', 'fa', 'cl'] | |
frontend = ['sf', 'eo', 'tr', 'oh', 'hp', 'dv', 'pe', 'fa'] | |
teams = [] | |
def draw(backend, frontend): | |
a = backend[random.randint(0, len(backend) - 1)] | |
b = frontend[random.randint(0, len(frontend) - 1)] | |
if a != b: | |
print '{} plays with {} !!!!!!'.format(a, b) | |
if a in backend: | |
backend.remove(a) | |
if b in backend: | |
backend.remove(b) | |
if a in frontend: | |
frontend.remove(a) | |
if b in frontend: | |
frontend.remove(b) | |
return a, b | |
return None, None | |
while backend and frontend: | |
print 'Throwing balls!' | |
time.sleep(2) | |
a, b = draw(backend, frontend) | |
if a and b: | |
teams.append((a, b)) | |
print 'Teams: {}'.format(teams) | |
print 'Pending backends: {}'.format(backend) | |
print 'Pending frontends: {}'.format(frontend) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment