in pysteve/lib/plugins/stv.py [0:0]
def try_remove_lowest(surplus, candidates):
lowest1 = 1e18
lowest2 = 1e18
which = None
for c in candidates.l:
if c.status == HOPEFUL and c.vote < lowest1:
lowest1 = c.vote
which = c
if not which:
debug.append("Could not find a subject to eliminate")
return False
for c in candidates.l:
if c != which and c.status != ELIMINATED and c.vote < lowest2:
lowest2 = c.vote
diff = lowest2 - lowest1
if diff >= 0.0:
debug.append('Lowest Difference = %.9f - %.9f = %.9f' % ( lowest2, lowest1, diff))
if diff > surplus:
debug.append('Remove Lowest (unforced)')
which.eliminate()
return True
return False