X-Git-Url: https://projects.mako.cc/source/rubyvote/blobdiff_plain/ca21f7527ba633db0457aa6cffc691c1eb4925ca..cf5965fdd417de3118228fb879a9cd88def215ea:/lib/rubyvote/condorcet.rb diff --git a/lib/rubyvote/condorcet.rb b/lib/rubyvote/condorcet.rb index 68b3c70..340be92 100644 --- a/lib/rubyvote/condorcet.rb +++ b/lib/rubyvote/condorcet.rb @@ -76,8 +76,6 @@ class CondorcetVote < ElectionVote # make sure we have a comparable object @votes[loser][winner] = 0 unless @votes[loser].has_key?( winner ) - - @candidates << loser unless @candidates.include?( loser ) end end end @@ -135,6 +133,7 @@ class CondorcetResult < ElectionResult 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 @@ -206,6 +205,7 @@ class CloneproofSSDResult < CondorcetResult # 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|