if vote.length - 1 == index
losers = []
else
- losers = vote.last( vote.flatten.length - index )
+ losers = vote.flatten.last( vote.flatten.length - index - 1)
end
losers.each do |place|
place = [place] unless place.class == Array
place.each do |loser|
- next if winner == loser
@votes[winner] = Hash.new unless @votes.has_key?(winner)
@votes[loser] = Hash.new unless @votes.has_key?(loser)
end
def result
- top_result = resultFactory( self )
- until @candidates.empty?
- aResult = resultFactory( self )
- top_result.full_results << aResult
- filter_out(aResult)
- end
- top_result
+ resultFactory( self )
end
protected
def resultFactory(init)
CloneproofSSDResult.new(init)
end
+
+ def result
+ top_result = resultFactory( self )
+ until @candidates.empty?
+ aResult = resultFactory( self )
+ top_result.full_results << aResult
+ filter_out(aResult)
+ end
+ top_result
+ end
+
end
votes = @election.votes unless votes
defeats = Array.new
+ candidates = [candidates] unless candidates.class == Array
candidates.each do |candidate|
candidates.each do |challenger|
next if candidate == challenger
# see the array with the standard defeats
transitive_defeats = self.defeats(candidates, votes)
+ candidates = [candidates] unless candidates.class == Array
candidates.each do |cand1|
candidates.each do |cand2|
candidates.each do |cand3|