80 lines
2.1 KiB
Text
80 lines
2.1 KiB
Text
To add an attribute to some stats:
|
|
Allocate memory for an entry.
|
|
Put the attribute into the entry's attribute.
|
|
Append the entry to the stats.
|
|
|
|
An attribute is a number.
|
|
|
|
An entry is a thing with an attribute.
|
|
|
|
To find a count of attributes greater than fourteen in some stats:
|
|
Put 0 into the count.
|
|
Get an entry from the stats.
|
|
Loop.
|
|
If the entry is nil, exit.
|
|
If the entry's attribute is greater than 14, bump the count.
|
|
Put the entry's next into the entry.
|
|
Repeat.
|
|
|
|
To find a sum of some stats:
|
|
Put 0 into the sum.
|
|
Get an entry from the stats.
|
|
Loop.
|
|
If the entry is nil, exit.
|
|
Add the entry's attribute to the sum.
|
|
Put the entry's next into the entry.
|
|
Repeat.
|
|
|
|
To generate an attribute:
|
|
Put 0 into the attribute.
|
|
Put 6 into a minimum number.
|
|
Loop.
|
|
If a counter is past 4, break.
|
|
Pick a number between 1 and 6.
|
|
Add the number to the attribute.
|
|
If the number is less than the minimum, put the number into the minimum.
|
|
Repeat.
|
|
Subtract the minimum from the attribute.
|
|
|
|
To generate some stats (raw):
|
|
If a counter is past 6, exit.
|
|
Generate an attribute.
|
|
Add the attribute to the stats.
|
|
Repeat.
|
|
|
|
To generate some stats (valid):
|
|
Generate some raw stats (raw).
|
|
Find a sum of the raw stats.
|
|
If the sum is less than 75, destroy the raw stats; repeat.
|
|
Find a count of attributes greater than fourteen in the raw stats.
|
|
If the count is less than 2, destroy the raw stats; repeat.
|
|
Put the raw stats into the stats.
|
|
|
|
To run:
|
|
Start up.
|
|
Show some RPG attributes.
|
|
Wait for the escape key.
|
|
Shut down.
|
|
|
|
To show some RPG attributes:
|
|
Generate some stats (valid).
|
|
Find a sum of the stats.
|
|
Find a count of attributes greater than fourteen in the stats.
|
|
Write the stats on the console.
|
|
Destroy the stats.
|
|
Write "Total: " then the sum on the console.
|
|
Write "Number of stats greater than fourteen: " then the count on the console.
|
|
|
|
Some stats are some entries.
|
|
|
|
A sum is a number.
|
|
|
|
To write some stats on the console:
|
|
Get an entry from the stats.
|
|
Loop.
|
|
If the entry is nil, write "" on the console; exit.
|
|
Convert the entry's attribute to a string.
|
|
Write the string on the console without advancing.
|
|
If the entry's next is not nil, write ", " on the console without advancing.
|
|
Put the entry's next into the entry.
|
|
Repeat.
|