chiark
/
gitweb
/
~ian
/
appendix-a6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
print # devotee-tally-begin and devotee-tally-end
[appendix-a6.git]
/
compute
diff --git
a/compute
b/compute
index 45076cd8b2a3326420afc7dc0e35e1311001c300..6400382c45a97e726dcb1cfa35cce2a7d74e6c2b 100755
(executable)
--- a/
compute
+++ b/
compute
@@
-39,7
+39,7
@@
while (<>) {
next if m/^\s*\#/;
next unless m/\S/;
next if m/^\s/;
next if m/^\s*\#/;
next unless m/\S/;
next if m/^\s/;
- if (m/^([A-Z]+)\s*\=\s*(\S.*)$/) {
+ if (m/^([A-Z
0-9
]+)\s*\=\s*(\S.*)$/) {
my ($choname, $desc) = ($1,$2);
my $cho = addchoice($choname, Desc => $desc);
if ($desc =~ m/\[(\d+):(\d+)\]/) {
my ($choname, $desc) = ($1,$2);
my $cho = addchoice($choname, Desc => $desc);
if ($desc =~ m/\[(\d+):(\d+)\]/) {
@@
-66,7
+66,8
@@
our @vab;
# Go through the voters and construct V(A,B)
# Go through the voters and construct V(A,B)
-print "\nParsing \`simple' style ballots\n";
+print "\nParsing \`simple' style ballots\n# devotee-tally-begin\n"
+ if @invotes_cc;
# actually, we pre-parse them into @invotes_v
# since we want to show them as a tally sheet anyway
# actually, we pre-parse them into @invotes_v
# since we want to show them as a tally sheet anyway
@@
-111,6
+112,9
@@
foreach my $iv (@invotes_cc) {
push @invotes_v, [ $vstr, $voter ];
}
push @invotes_v, [ $vstr, $voter ];
}
+print "# devotee-tally-end\n"
+ if @invotes_cc;
+
print "\nDetermining default option\n";
if ($defcho && $defcho->{Index} > -1) {
print "\nDetermining default option\n";
if ($defcho && $defcho->{Index} > -1) {
@@
-132,7
+136,8
@@
if ($defcho && $defcho->{Index} > -1) {
my $defi = $defcho->{Index};
die "FD has smaj?!" if $defcho->{Smaj};
my $defi = $defcho->{Index};
die "FD has smaj?!" if $defcho->{Smaj};
-print "\nParsing devotee tally sheet ballots\n";
+print "\nParsing devotee tally sheet ballots\n"
+ if @invotes_v > @invotes_cc;
foreach my $iv (@invotes_v) {
my ($votestr,$voter) = @$iv;
foreach my $iv (@invotes_v) {
my ($votestr,$voter) = @$iv;
@@
-222,7
+227,7
@@
if (defined $defi) {
my $vad = scalar @{ $vab[$i][$defi] };
my $vda = scalar @{ $vab[$defi][$i] };
next if $vad * $majr->[1] > $vda * $majr->[0];
my $vad = scalar @{ $vab[$i][$defi] };
my $vda = scalar @{ $vab[$defi][$i] };
next if $vad * $majr->[1] > $vda * $majr->[0];
- drop $i, "majority ratio ($vad
* $majr->[1] <= $vda *
$majr->[0])";
+ drop $i, "majority ratio ($vad
:$vda <= $majr->[1]:
$majr->[0])";
}
}
}
}