import re
names = []
votes = {}
players = []
total = []
temp = 'you dun fucked up'
lovers1 = ['kingkitty', 'karkador', 'timeaisis', 'launchpadmcq', 'blargonaut','ultrajay', 'coppanuva', '*splinter', 'tl21xx',
'magnumboy20xx', 'rest', 'kyanrute', 'el topo', 'neverforever', 'sophia',]
lovers2 = ['hyperactivity', 'zippedpinhead', 'fluxwavez', 'gorlak', 'kawl_usc',
'boo boo\'n', 'flame_ac', 'cabot', 'camjo-z', 'batsnacks', 'karu', 'retroid', 'miracle', 'czartim', 'ty4on']
flags = [True,True,True,True,True,True,True,True,True,True,True,True,True,True,True]
list = open("votes.txt","r")
names = list.readlines()
i = 0
j = -1
for guy in names:
guy = re.sub(r'\([^)]*\)', '', guy)
guy = re.sub(r'\[url[^]]*\]', '', guy)
guy = re.sub(r'\[\/url[^]]*\]', '', guy)
guy = re.sub(r'\s*\n', '', guy)
names[i] = guy
i = i+1
for lynch in names:
if re.search(r'\[u(.*)u\]', lynch):
p = re.compile(r'\[u\]\[b\](?P<name>.*)\s\[')
q = p.search(lynch)
votes[q.group('name')]=[]
players.append(q.group('name'))
temp = q.group('name')
total.append(0)
j = j + 1
elif lynch!='':
subst = re.sub(r'\s\d+', '', lynch)
votes[temp].append(subst)
if not re.search(r'\[strike\]', subst):
total[j] = total[j] + 1
for ouro in players:
x = 0
if ouro in lovers1:
x = 1
ynnny = lovers1.index(ouro)
retro = lovers2[ynnny]
if retro in players:
damage = total[players.index(ouro)]+total[players.index(retro)]
else:
damage = total[players.index(ouro)]
if flags[ynnny]==True:
print("[b][u]"+str(ouro)+" & "+str(retro)+" ("+str(damage)+")[/u][/b]")
for z in range(len(votes[ouro])):
print(votes[ouro][z])
for z in range(len(votes[retro])):
print(votes[retro][z])
flags[ynnny]=False
elif ouro in lovers2:
x = 2
ynnny = lovers2.index(ouro)
retro = lovers1[ynnny]
if retro in players:
damage = total[players.index(ouro)]+total[players.index(retro)]
else:
damage = total[players.index(ouro)]
if flags[ynnny]==True:
print ("[b][u]"+str(retro)+" & "+str(ouro)+" ("+str(damage)+")[/u][/b]")
for z in range(len(votes[retro])):
print(votes[retro][z])
for z in range(len(votes[ouro])):
print(votes[ouro][z])
flags[ynnny]=False
print "\n"