-def print_winner(result)
- if not result.winner?
- puts "There is no winner."
- elsif result.winners.length == 1
- puts "The winner is %s" % result.winners[0]
- else
- puts "There is a tie between the following candidates: %s" % result.winners.join(", ")
- end
-end
-
-def condorcet_test1
- puts "USING CONDORCET..."
- puts "The winner should be: B"
-
- vote_array = Array.new
- 3.times {vote_array << "ABC".split("")}
- 3.times {vote_array << "CBA".split("")}
- 2.times {vote_array << "BAC".split("")}
-
- print_winner( PureCondorcetVote.new(vote_array).result )
-end
-
-def ssd_test1
- puts "USING CloneProofSSD..."
- puts "The winner should be: E"
-
- vote_array = Array.new
- 5.times {vote_array << "ACBED".split("")}
- 5.times {vote_array << "ADECB".split("")}
- 8.times {vote_array << "BEDAC".split("")}
- 3.times {vote_array << "CABED".split("")}
- 7.times {vote_array << "CAEBD".split("")}
- 2.times {vote_array << "CBADE".split("")}
- 7.times {vote_array << "DCEBA".split("")}
- 8.times {vote_array << "EBADC".split("")}
-
- print_winner( CloneproofSSDVote.new(vote_array).result )
-end
-
-def ssd_test2
- puts "USING CloneProofSSD..."
- puts "The winner should be: D"
-
- vote_array = Array.new
- 5.times {vote_array << "ACBD".split("")}
- 2.times {vote_array << "ACDB".split("")}
- 3.times {vote_array << "ADCB".split("")}
- 4.times {vote_array << "BACD".split("")}
- 3.times {vote_array << "CBDA".split("")}
- 3.times {vote_array << "CDBA".split("")}
- 1.times {vote_array << "DACB".split("")}
- 5.times {vote_array << "DBAC".split("")}
- 4.times {vote_array << "DCBA".split("")}
-
- print_winner( CloneproofSSDVote.new(vote_array).result )
-end
-
-def ssd_test3
- puts "USING CloneProofSSD..."
- puts "The winner should be: B(?)"
-
- vote_array = Array.new
- 3.times {vote_array << "ABCD".split("")}
- 2.times {vote_array << "DABC".split("")}
- 2.times {vote_array << "DBCA".split("")}
- 2.times {vote_array << "CBDA".split("")}
-
- print_winner( CloneproofSSDVote.new(vote_array).result )
-end