Use an array, not a reference to an array for @tix.
This commit is contained in:
parent
05b86946fa
commit
101baf1938
1 changed files with 6 additions and 5 deletions
11
megabucks.plx
Normal file → Executable file
11
megabucks.plx
Normal file → Executable file
|
|
@ -19,9 +19,10 @@ my(@choices) = $min .. $max;
|
|||
my %done;
|
||||
|
||||
my $curTix = 0;
|
||||
my $tix;
|
||||
my @tix;
|
||||
while ($curTix < $tixCount) {
|
||||
while (@{$tix->[$curTix]} < $perTix) {
|
||||
$tix[$curTix] = [];
|
||||
while (@{$tix[$curTix]} < $perTix) {
|
||||
my $rr;
|
||||
while (read($randomFH, $rr, 4) != 4) { }
|
||||
$rr = unpack("I", $rr) % scalar(@choices);
|
||||
|
|
@ -30,14 +31,14 @@ while ($curTix < $tixCount) {
|
|||
$done{$rr} = 1;
|
||||
} else {
|
||||
next if $rr < 31;
|
||||
my %inThisTicket = map { $_, 1 } @{$tix->[$curTix]}; next if $inThisTicket{$rr};
|
||||
my %inThisTicket = map { $_, 1 } @{$tix[$curTix]}; next if $inThisTicket{$rr};
|
||||
my $min = min(grep { $_ > 31} values %done); next if $done{$rr} > $min;
|
||||
}
|
||||
push(@{$tix->[$curTix++]}, $rr);
|
||||
push(@{$tix[$curTix]}, $rr);
|
||||
}
|
||||
$curTix++;
|
||||
}
|
||||
my $count = 1;
|
||||
foreach my $ticket (@{$tix}) {
|
||||
foreach my $ticket (@tix) {
|
||||
print "Ticket $count: ", join(" ", sort { $a <=> $b } @$ticket), "\n";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue