Sha256: 102bb2dfeb775ea5740396bc72bf373af9d22182e0fd1077144e6fec92ac4e3d
Contents?: true
Size: 833 Bytes
Versions: 1
Compression:
Stored size: 833 Bytes
Contents
# encoding: UTF-8 module Vote module Condorcet module Schulze class Input @vote_matrix = nil def initialize candidate_count, vote_list @vote_matrix = ::Matrix.scalar(candidate_count,0).extend(Vote::Matrix) insert_vote_array(vote_list) if vote_list.is_a?(Array) insert_vote_file(vote_list) if vote_list.is_a?(File) end def insert_vote_array va va.each do |vote| @vote_matrix.each_with_index do |e,x,y| next if x==y @vote_matrix[x,y] += 1 if vote[x]>vote[y] end end end def insert_vote_list vl #... end def insert_vote_file vf #... end def matrix @vote_matrix end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vote-schulze-0.1.0 | lib/vote/condorcet/schulze/input.rb |