37 lines
765 B
Plaintext
37 lines
765 B
Plaintext
function min(a, b)
|
|
if a < b then return a else return b
|
|
end function
|
|
|
|
function d6()
|
|
#simulates a marked regular hexahedron coming to rest on a plane
|
|
return 1 + int(rand * 6)
|
|
end function
|
|
|
|
function roll_stat()
|
|
#rolls four dice, returns the sum of the three highest
|
|
a = d6() : b = d6() : c = d6() : d = d6()
|
|
return a + b + c + d - min(min(a, b), min(c, d))
|
|
end function
|
|
|
|
arraybase 1
|
|
dim statnames$ = {"STR", "CON", "DEX", "INT", "WIS", "CHA"}
|
|
dim stat(6)
|
|
acceptable = false
|
|
|
|
do
|
|
sum = 0 : n15 = 0
|
|
for i = 1 to 6
|
|
stat[i] = roll_stat()
|
|
sum += stat[i]
|
|
if stat[i] >= 15 then n15 += 1
|
|
next i
|
|
if sum >= 75 and n15 >= 2 then acceptable = true
|
|
until acceptable
|
|
|
|
for i = 1 to 6
|
|
print statnames$[i]; ": "; stat[i]
|
|
next i
|
|
print "-------"
|
|
print "TOT: "; sum
|
|
end
|