chiark / gitweb /
compute-scottish-stv: make --for-compare list winners too
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 23 Aug 2016 12:46:39 +0000 (13:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 23 Aug 2016 12:46:39 +0000 (13:46 +0100)
compute-scottish-stv

index 40a6667..43d3a72 100755 (executable)
@@ -220,6 +220,12 @@ sub countballots () {
        push @pr, $c;
     }
 
        push @pr, $c;
     }
 
+    if ($for_compare) {
+       # for comparison with OpenSTV, which always prints
+       # the quota for every elected candidate
+       push @pr, { %$_, Total => $quota } foreach @elected;
+    }
+
     foreach my $c (reverse sort $display_cmp @pr) {
        prf "candidate %-10s: %s votes\n", $c->{Cand}, sv $c->{Total};
     }
     foreach my $c (reverse sort $display_cmp @pr) {
        prf "candidate %-10s: %s votes\n", $c->{Cand}, sv $c->{Total};
     }