chiark / gitweb /
compute-scottish-stv: Fix tie breaks main
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Apr 2020 20:02:16 +0000 (21:02 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 26 Apr 2020 20:02:16 +0000 (21:02 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
compute-scottish-stv

index 98ec3082bd92de269a79af720f4ba8472c8f163a..788cb32668a20a0013f0db43fcab3a8121575613 100755 (executable)
@@ -95,7 +95,7 @@ for (;;) {
            } elsif (m/^_?[Tt]ie=(.*)\>(.*)$/) {
                my @more = split /\,/, $1;
                my @less = split /\,/, $2;
-               my @all = join ',', sort (@more, @less);
+               my @all = join ' ', sort (@more, @less);
                $tie{"@all"}{Win}  = $more[0] if @more == 1;
                $tie{"@all"}{Lose} = $less[0] if @less == 1;
            } else {
@@ -301,7 +301,7 @@ sub select_best_worst ($$$$) {
 
     my $selectcand;
     if ($nequal > 1) {
-       my @all = map { $_->{Cand} } @maybe[0 .. $nequal-1];
+       my @all = sort map { $_->{Cand} } @maybe[0 .. $nequal-1];
        my $tiekey = $signum > 0 ? 'Win' : 'Lose';
        $selectcand = $tie{"@all"}{$tiekey};
        die "need tie break, want $tiekey from @all"