prettier lists

This commit is contained in:
James Scott 2012-12-16 20:13:20 -05:00
parent 33213f2bb5
commit dfe3551ce2
1 changed files with 5 additions and 4 deletions

View File

@ -106,17 +106,18 @@ class Cah(callbacks.Plugin):
def _tallyVotes(self, votes):
ties = []
winningCanidate = None
winningCanidate = []
canidatesById = []
for nick in self.cardsPlayed.keys():
canidatesById.append(nick)
for canidateNumber, count in votes.iteritems():
canidate = canidatesById[canidateNumber]
if len(winningCanidate) == None:
winningCanidate = [(canidate, count), ]
if len(winningCanidate) == 0:
winningCanidate.append(canidate, count))
elif winningCanidate[0][1] < count:
winningCanidate = ((canidate, count), ]
winningCanidate = []
winningCanidate.append((canidate, count))
elif winningCanidate[0][1] == count:
winningCanidate.append((canidate, count))