chiark / gitweb /
improve a msg
[appendix-a6.git] / compute
diff --git a/compute b/compute
index 61c0350e72e726a84b6c9b8170372148ec528430..a58e2505cc5b7f3006732ede785763be54d6b5f9 100755 (executable)
--- a/compute
+++ b/compute
@@ -39,7 +39,7 @@ while (<>) {
     next if m/^\s*\#/;
     next unless m/\S/;
     next if m/^\s/;
-    if (m/^([A-Z]+)\s*\=\s*(\S.*)$/) {
+    if (m/^([A-Z0-9]+)\s*\=\s*(\S.*)$/) {
        my ($choname, $desc) = ($1,$2);
        my $cho = addchoice($choname, Desc => $desc);
        if ($desc =~ m/\[(\d+):(\d+)\]/) {
@@ -66,7 +66,7 @@ our @vab;
 
 # Go through the voters and construct V(A,B)
 
-print "\nParsing \`simple' style ballots\n"
+print "\nParsing \`simple' style ballots\n# devotee-tally-begin\n"
         if @invotes_cc;
 # actually, we pre-parse them into @invotes_v
 # since we want to show them as a tally sheet anyway
@@ -112,6 +112,9 @@ foreach my $iv (@invotes_cc) {
     push @invotes_v, [ $vstr, $voter ];
 }
 
+print "# devotee-tally-end\n"
+        if @invotes_cc;
+
 print "\nDetermining default option\n";
 
 if ($defcho && $defcho->{Index} > -1) {
@@ -124,7 +127,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";
     }
@@ -277,6 +280,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";