From: Ian Jackson Date: Sun, 26 Apr 2020 20:02:16 +0000 (+0100) Subject: compute-scottish-stv: Fix tie breaks X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=appendix-a6.git;a=commitdiff_plain;ds=sidebyside compute-scottish-stv: Fix tie breaks Signed-off-by: Ian Jackson --- diff --git a/compute-scottish-stv b/compute-scottish-stv index 98ec308..788cb32 100755 --- a/compute-scottish-stv +++ b/compute-scottish-stv @@ -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"