X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=appendix-a6.git;a=blobdiff_plain;f=compute-scottish-stv;h=47604073388b5a14acc81a847ea9142e2ca05a2b;hp=528cc5f0891a1556a26ed89c96547406122e1dba;hb=84f29cff3e89696386bdfe27182d53a28edb9c97;hpb=6f5838e665e31aa6d3e1216eb6e29884254b0f5a diff --git a/compute-scottish-stv b/compute-scottish-stv index 528cc5f..4760407 100755 --- a/compute-scottish-stv +++ b/compute-scottish-stv @@ -207,8 +207,8 @@ sub countballots () { sub computequota () { my $totalvalid = 0/1; $totalvalid += $_->{Total} foreach values %cands; - $quota = floor($totalvalid / (1 + $seats)); - prf "quota %s\n", sv $quota; + $quota = floor($totalvalid / (1 + $seats) + 1); + prf "total valid %s quota %s\n", (sv $totalvalid), (sv $quota); } sub total_history_cmp () { @@ -334,6 +334,8 @@ for (;;) { next; } + last if $seats_remain == 1; # don't bother doing more transfers + my $B = $c->{Total}; my %tspr; @@ -354,7 +356,7 @@ for (;;) { die unless $tspr{"@$previously"} == $xfervalue; } else { $tspr{"@$previously"} = $xfervalue; - prf "transfer value of ballots %s: %s\n", + prf "transfer value of ballots %20s: %s\n", "@$previously", sv $xfervalue; } }