Two Programs to Calculate Condorcet Winners

Two Programs to Calculate Condorcet Winners

This is and condorcet.cgi, two programs which tally ranked preference ballots using Condorcet's method. They are both written in Perl, and are in essense the same program with a different wrapper.

condorcet.cgi creates much more aesthetically pleasing HTML 2.0+ tables than the plain text output of If you want to see condorcet.cgi in action, check out the working version of the program. This is only the initial alpha release of this script. It's pretty crude, and the documentation is pretty much the program. This is just a release for the technically inclined. If you do decide to try it out, please let me know what you think. I was going to wait until I had the time to get everything documented and tested, but I would probably just wait forever.

Hopefully, there will be more user-friendly releases in the near future. I'll announce new versions here as they become available.

Getting To Work

If you are unfamiliar with Perl, check for info in the following places: Perl is essentially the Swiss Army Chainsaw of scripting languages, and it runs on just about every operating system available. Note, though, that this script runs only with Perl version 5. is freely available software, licensed under the GNU Public License.

usage: perl [-t] candidate-list ballot-list

Here's what it all means:

 -t    Print the raw tally table. (pair-wise election results)

 candidate-list - contains a two column, comma-separated list of
                  candidate number and candidate names.  Candidate    
        	  numbers can be any non-negative integers of unlimited
		  size.  For efficiency, numbering should start at zero
	          and proceed up in increments of one, but this is not
	          a requirement.

 ballot-list -    this should be a list of ballots, one per line.  Each
  	          line should contain a list of candidate numbers
		  separated by commas.

Ballots are not checked for validity, and results may be unpredictable with bad input.

Copyright 1995 Rob Lanphier

This program may be copied under the terms of the GNU public license, version 2.

Now for the script itself.

Back to the Condorcet's Method Home Page Political Justification of Condorcet's Method Interactive Demo of Condorcet's Method Technical Explanation of Condorcet's Method

Related sites:
Rob's Homepage