From 9d63d51c44fa2a87af05ed014ca8d6632eb4c19f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 26 Apr 2020 21:02:16 +0100 Subject: [PATCH] compute-scottish-stv: Fix tie breaks Signed-off-by: Ian Jackson --- compute-scottish-stv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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" -- 2.30.2