chiark
/
gitweb
/
~ian
/
appendix-a6.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0f260f3
)
stv: fix historically_prefer
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Mon, 1 Aug 2016 16:09:52 +0000
(17:09 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Mon, 1 Aug 2016 16:09:52 +0000
(17:09 +0100)
stv
patch
|
blob
|
history
diff --git
a/stv
b/stv
index dae5563dd79bfd6a46474a7c3e08a61d0b385d51..3942b6b175f488c6dbbedfd6338ded2560eb450c 100755
(executable)
--- 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;