From: | shadowrn@*********.com (shadowrn@*********.com) |
---|---|
Subject: | D6 script |
Date: | Fri Jan 4 11:35:09 2002 |
thought I'd drop that in, too..
thanks to Gurth for thoughts, original python code etc on the D8 script..
<-- cut and paste below here
#!/usr/bin/perl -w
# script to generate dice rolls for shadowrun
# inspired by Gurth's Python script
# john@*****.net
# version 1
use strict;
@**** == 1 || die "Usage: $0 number of dice to roll\n";
# Declare the variables
my ($dice, $count, $roll, $reroll);
my (@*****);
#Initialise the variables
$dice = $ARGV[0];
$count = 0;
# generate a dice roll until the number of dice specified has been met,
# and append it to the @***** array
while ($count < $dice) {
$count++;
$roll = int(rand(6)) + 1;
$reroll = 1;
while ($roll % 6 == 0 && $roll != 0 && $reroll !=0) {
$reroll = int(rand(6)) + 1;
$roll = $roll + $reroll
}
push (@*****, $roll);
}
# sorting's not perfect, but hey, its free!
foreach (sort @*****) {
print "$_ ";
}
print "\n";
<--- stop cutting here
enjoy/ignore! :-)
--
john@*****.net
"For you're sake, you'd better be psychic, or armed" - goats
SRGC SR1+ SR3++ !SR2 h b++ B--- UB IE+ RN+ !W ma+++ gm M-- P-