18 lines
596 B
Text
18 lines
596 B
Text
with javascript_semantics
|
|
sequence numbers = repeat(0,6)
|
|
integer t,n
|
|
while true do
|
|
for i=1 to length(numbers) do
|
|
sequence ni = sq_rand(repeat(6,4))
|
|
numbers[i] = sum(ni)-min(ni)
|
|
end for
|
|
t = sum(numbers)
|
|
n = sum(sq_ge(numbers,15))
|
|
if t>=75 and n>=2 then exit end if
|
|
?"re-rolling..." -- (occasionally >20)
|
|
end while
|
|
printf(1,"The 6 attributes generated are:\n")
|
|
printf(1,"strength %d, dexterity %d, constitution %d, "&
|
|
"intelligence %d, wisdom %d, and charisma %d.\n",
|
|
numbers)
|
|
printf(1,"\nTheir sum is %d and %d of them are >=15\n",{t,n})
|