From be8af598391869fa6bb4cf9ccf630a09f6c2edd8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 1 Aug 2016 17:09:52 +0100 Subject: [PATCH 1/1] stv: fix historically_prefer --- stv | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stv b/stv index dae5563..3942b6b 100755 --- a/stv +++ b/stv @@ -106,13 +106,14 @@ sub historically_prefer ($@) { return 0; }; - @choices = sort $compare, @choices; + @choices = sort $compare @choices; $a = $choices[0]; - my $numequal = 0; + my $numequal = 1; for (;;) { - last unless $numequal >= @choices; + last if $numequal >= @choices; $b = $choices[$numequal]; last if $compare->(); + $numequal++; } die 'random choice unimplemented' if $numequal > 1; -- 2.30.2