in reply to Trick die rolling

(Warning: untested code ahead)

sub roll { my ($max) = @_; return 1 + int rand $max; } sub sum { my $sum = 0; $sum += $_ for @_; return $sum; } my @dice; ROLL: for (1..4) { push @dice, roll 6; pop @dice and redo ROLL if $dice[-1] == 1; } # Discard lowest @dice = sort { $a <=> $b } @dice; unshift @dice; my $sum = sum @dice;

44696420796F7520732F2F2F65206F
7220756E7061636B3F202F6D736720
6D6521203A29202D2D204A75657264