X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=appendix-a6.git;a=blobdiff_plain;f=compute;h=c544437bdb05468ed7f94076829c884d609a54f4;hp=6400382c45a97e726dcb1cfa35cce2a7d74e6c2b;hb=ec0d2dafa7c72f2f7d77e77c7859ca9aad7635d9;hpb=72430a6c24f496d33af833d4c4f00b2bd209821a
diff --git a/compute b/compute
index 6400382..c544437 100755
--- a/compute
+++ b/compute
@@ -4,8 +4,50 @@
# to Debian Constitution A.6.
#
# usage: .../compute [...]
+# (uses stdin if none supplied)
#
-#
+# input files can be in any order and should contain lines like:
+#
+# :: , (=), , ....
+# V:
+# =
+# = [:]
+# = [default]
+# nodefault
+# quorum =
+#
+# where
+#
+# is any non-whitespace characters
+#
+# and are abbreviations for choices on the ballot.
+# They must be ASCII alphanumeric. Numeric preferences are
+# not recommended as they are confusing (particularly when
+# tally sheets are in use).
+#
+# It is best to avoid FD, SQ and NOTA except for the default
+# option; if no default option is specified, it will default
+# to one of these unless a "nodefault" line is found.
+#
+# In the "::" form, the commas are optional. Either ( ) or = may
+# be used to indicate a set of equal preferences.
+#
+# is a tally sheet preference order: that is,
+# a single uppercase base36 digit for each ballot choice,
+# (in the order they were specified by "=" lines), giving
+# the voter's preference rank for that option. The numbers
+# need not be distinct or contiguous. "-" may be used for
+# unranked preferences.
+#
+# : is the majority ratio for the option
+#
+# is the quorum
+#
+# and also allowed are
+#
+# #-comments } all
+# blank lines } ignored
+# lines starting with whitespace }
use strict;
use utf8;
@@ -127,7 +169,7 @@ if ($defcho && $defcho->{Index} > -1) {
last if $defcho;
}
if ($defcho) {
- print "guessed default option was: $choices[$defcho->{Index}]\n";
+ print "guessed default option: $choices[$defcho->{Index}]\n";
} else {
print "could not guess default option, assuming there is none\n";
}
@@ -280,6 +322,10 @@ for (;;) {
my $tdefeats = $defeats->transitive_closure();
+ # this makes the debugging output prettier
+ foreach my $ch (@choices) {
+ $tdefeats->delete_edge($ch,$ch);
+ }
print "closure graph: $tdefeats\n";
print "\nSchwartz set A.6(6)\n";