RPG attributes generator: Difference between revisions

Add LDPL
(Add LDPL)
Line 2,620:
Attribute value total: 81
Attribule count >= 15: 2 </pre>
 
=={{header|LDPL}}==
<syntaxhighlight lang="ldpl">data:
attributes is number list
i is number
attr is number
sum is number
count is number
 
procedure:
sub attribute
parameters:
result is number
local data:
min is number
n is number
i is number
procedure:
store 6 in min
for i from 0 to 4 step 1 do
get random in n
in n solve 6 * n + 1
floor n
add n and result in result
if n is less than min then
store n in min
end if
repeat
subtract min from result in result
end sub
create statement "get attribute in $" executing attribute
 
label generate-attributes
for i from 0 to 6 step 1 do
get attribute in attr
add attr and sum in sum
if attr is greater than 14 then
add count and 1 in count
end if
push attr to attributes
store 0 in attr
repeat
 
if sum is less than 75 or count is less than 2 then
display "Failed..." lf
store 0 in sum
store 0 in count
clear attributes
goto generate-attributes
end if
 
for each attr in attributes do
display attr " "
repeat
display lf "Sum: " sum lf ">14: " count lf
</syntaxhighlight>
{{out}}
<pre>
Failed...
Failed...
Failed...
Failed...
11 15 12 16 15 15
Sum: 84
>14: 4
</pre>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
1,808

edits