chiark / gitweb /
wip better msgs before fix graph names
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 2 Feb 2014 20:47:06 +0000 (20:47 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 2 Feb 2014 20:47:06 +0000 (20:47 +0000)
parse

diff --git a/parse b/parse
index adb3d7df3ad1062d5759645458f61b9513087644..7ca1ed6aa70817165ca476ac6323a37f4404506e 100755 (executable)
--- a/parse
+++ b/parse
@@ -57,6 +57,8 @@ our @vab;
 
 # Go through the voters and construct V(A,B)
 
 
 # Go through the voters and construct V(A,B)
 
+print "\nDefeats matrix\n";
+
 foreach my $iv (@invotes) {
     my ($votestr,$voter) = @$iv;
     eval {
 foreach my $iv (@invotes) {
     my ($votestr,$voter) = @$iv;
     eval {
@@ -122,7 +124,7 @@ sub drop ($$) {
     $ch[$i]{Dropped} = $why;
 }
 
     $ch[$i]{Dropped} = $why;
 }
 
-print "# quorum A.6(2)\n";
+print "\nQuorum A.6(2) (quorum is $quorum)\n";
 
 foreach my $i (0..$#choices) {
     next if $ch[$i]{Dropped};
 
 foreach my $i (0..$#choices) {
     next if $ch[$i]{Dropped};
@@ -132,7 +134,7 @@ foreach my $i (0..$#choices) {
     drop $i, "quorum ($v < $quorum)";
 }
 
     drop $i, "quorum ($v < $quorum)";
 }
 
-print "# maj. ratio A.6(3)\n";
+print "\nMajority ratio A.6(3)\n";
 
 foreach my $i (0..$#choices) {
     next if $ch[$i]{Dropped};
 
 foreach my $i (0..$#choices) {
     next if $ch[$i]{Dropped};
@@ -173,20 +175,20 @@ sub weaker ($$) {
     return 0;
 }
 
     return 0;
 }
 
-print "defeats graph: $defeats\n";
-
 our $schwartz;
 
 for (;;) {
     # loop from A6(5)
 
 our $schwartz;
 
 for (;;) {
     # loop from A6(5)
 
-    print "# transitive closure A.6(5)\n";
+    print "defeats graph: $defeats\n";
+
+    print "\nTransitive closure A.6(5)\n";
 
     my $tdefeats = $defeats->transitive_closure();
 
     print "closure graph: $tdefeats\n";
 
 
     my $tdefeats = $defeats->transitive_closure();
 
     print "closure graph: $tdefeats\n";
 
-    print "Schwartz set A.6(6)\n";
+    print "\nSchwartz set A.6(6)\n";
     
     $schwartz = $defeats->copy();
 
     
     $schwartz = $defeats->copy();
 
@@ -200,7 +202,7 @@ for (;;) {
        }
     }
 
        }
     }
 
-    print "# dropping weakest defeats A.6(7)\n";
+    print "\nDropping weakest defeats A.6(7)\n";
 
     our @weakest = ();
 
 
     our @weakest = ();
 
@@ -230,11 +232,17 @@ for (;;) {
        $defeats->delete_edge($ia,$ib);
     }
 
        $defeats->delete_edge($ia,$ib);
     }
 
-    print "defeats within the Schwartz set, round again\n";
+    print "defeats within the Schwartz set, round again\n";
 }
 
 }
 
-print "# no defeats within the Schwartz set\n";
-print "FINAL SCHWARTZ SET:\n";
+print "no defeats within the Schwartz set\n";
+print "final schwartz set:\n\n";
+
+if ($schwartz->vertices() == 1) {
+    print "WINNER IS:\n";
+} else {
+    print "WINNER IS ONE OF (CASTING VOTE DECIDES):\n";
+}
 
 printf "    %-5s %s\n", $choices[$_], $ch[$_]{Desc}
     foreach ($schwartz->vertices());
 
 printf "    %-5s %s\n", $choices[$_], $ch[$_]{Desc}
     foreach ($schwartz->vertices());