chiark / gitweb /
compute-scottish-stv: wip adjust stage 1
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Aug 2016 20:12:19 +0000 (21:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Aug 2016 20:12:19 +0000 (21:12 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
compute-scottish-stv

index 6fde103..575f10e 100755 (executable)
@@ -244,15 +244,13 @@ sub elect_core ($) {
     $c->{NonCont} = 'Elected';
 }
 
-$stage = 1;
-
-sortballots @allvotes;
-countballots();
-computequota();
+$stage = 0;
 
 for (;;) {
     $stage++;
 
+    sortballots @allvotes if $stage == 1;
+
     my $seats_remain = $seats
        - grep { ($_->{NonCont} // '') eq 'Elected' } values %cands;
     if (continuing() <= $seats_remain) {
@@ -265,6 +263,8 @@ for (;;) {
 
     countballots();
 
+    computequota if $stage == 1;
+
     my $c = select_best_worst
        sub { $_->{Total} >= $quota },
        sub { $_ > $quota },