def victories_and_ties
victors = Array.new
ties = Array.new
+ victories = Hash.new
candidates = @matrix.keys.sort
candidates.each do |candidate|
end
end
end
-
- victories = victors.sort {|a,b| b[2] <=> a[2]}
+
+ victors.each do |list|
+ if victories.has_key?(list[0])
+ victories[list[0]][list[1]] = list[2]
+ else
+ victories[list[0]] = Hash.new
+ victories[list[0]][list[1]] = list[2]
+ end
+ end
return victories, ties
end