skidooesy / stv

Automatically exported from code.google.com/p/stv
0 stars 0 forks source link

Cambridge does not report tiebreaking details in eliminating candidates #26

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
  def transferVotesFromLosers(self, cLosers):
    "Eliminate candidate according to the Cambridge rules."

    # Transfer from candidates with fewest votes first
    remainingLosers = cLosers[:]
    ppp = self.purgatory[:]
    for j in range(len(remainingLosers)):
      ##### desc is thrown away
      (loser, desc) = self.breakWeakTie(self.R-1, remainingLosers, "fewest",
                                        "order of candidate elimination")
      remainingLosers.remove(loser)
      for bi in self.votes[loser]:
        c = self.cleanBallots.getTopChoiceFromBallot(bi, ppp)
        if c != None:
          self.votes[c].append(bi)
          # If receiving candidate becomes a winner, then that
          # candidate can't receive any more votes.
          if len(self.votes[c]) >= self.thresh[self.R-1]:
            ppp.remove(c)

      self.votes[loser] = []

    desc = "Count after eliminating %s and transferring votes. " % \
         self.cleanBallots.joinList(cLosers)
    return desc

Original issue reported on code.google.com by jeff.oneill on 18 Oct 2009 at 7:54

GoogleCodeExporter commented 9 years ago

Original comment by jeff.oneill on 20 Oct 2009 at 2:31