Skip to content

Instantly share code, notes, and snippets.

@fern4lvarez
Created March 24, 2014 17:02
Show Gist options
  • Save fern4lvarez/9744484 to your computer and use it in GitHub Desktop.
Save fern4lvarez/9744484 to your computer and use it in GitHub Desktop.
kicker tournament for cctrl
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