Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,49 @@
|
|||
_elements = 6
|
||||
|
||||
local fn min( a as long, b as long ) as long
|
||||
long result
|
||||
if ( a < b )
|
||||
result = a : exit fn
|
||||
else
|
||||
result = b : exit fn
|
||||
end if
|
||||
end fn = result
|
||||
|
||||
local fn d6 as long
|
||||
long result
|
||||
result = 1 + int( rnd(_elements) )
|
||||
end fn = result
|
||||
|
||||
local fn roll_stat as long
|
||||
long result
|
||||
long a = fn d6, b = fn d6, c = fn d6, d = fn d6
|
||||
result = a + b + c + d - fn min( fn min( a, b ), fn min( c, d ) )
|
||||
end fn = result
|
||||
|
||||
local fn DoIt
|
||||
CFArrayRef statnames = @[@"Strength",@"Constitution",@"Dexterity",@"Intelligence",@"Wisdom",@"Charisma"]
|
||||
long stat(_elements), n15, sum, i
|
||||
BOOL acceptable = NO
|
||||
|
||||
randomize
|
||||
do
|
||||
sum = 0
|
||||
n15 = 0
|
||||
for i = 1 to _elements
|
||||
stat(i) = fn roll_stat
|
||||
sum = sum + stat(i)
|
||||
if stat(i) >= 15 then n15++
|
||||
next
|
||||
if sum >= 75 and n15 >= 2 then acceptable = YES
|
||||
until ( acceptable = YES )
|
||||
|
||||
for i = 1 to _elements
|
||||
printf @"%12s %3ld", fn StringUTF8String( statnames[i -1] ), stat(i)
|
||||
next
|
||||
printf @"------------"
|
||||
printf @"%13s %3ld", "Total:", sum
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue