A sample implementation of ranked choice voting - inspired by Minneapolis MN Code of Ordinances (http://library.municode.com/HTML/11490/level3/COOR_TIT8.5EL_CH167MUELRUCO.html#COOR_TIT8.5EL_CH167MUELRUCO_167.10AP)
To run a sample election: ./election.py
To run an election with your own input file: ./election.py my-election-votes.csv
- Note: I am expecting that an election votes file consists of one "vote" per line where a vote consists of a series of one or more ranked choice elections
Valid ranked choice elections samples
bob,susie,john
bob
susie,fred
At a double-blind drip coffee tasting at Vertigo, participants were asked to submit a ballot of ranked choices of the following brews:
- Philz "Ambrosia of God"
- Peet's "Major Dickason's"
- Ultimate Java "House Blend"
- Kona coffee (roaster unknown)
- Philz "Jacob Wonderbar"
The results are in coffee.csv
. First place went to Kona, second to
Philz Ambrosia blend.
Results came from running ./election.py coffee.csv
. There are some
last place ties where one must make some difficult choices. Not really:
it's just coffee. When you run the algorithm, it will ask you to
make a choice of the three way tie for last: I picked Dickason
mostly because life is unfair and I don't like Peet's, even though I
live in Berkeley.
This software comes with no warranties or guarantee on results. Use it at your own risk. And, by using it you release me from any legal ramifications whatsoever. And also, enjoy!