RPG   =   Role Playing Game.



You're running a tabletop RPG, and your players are creating characters.

Each character has six core attributes: strength, dexterity, constitution, intelligence, wisdom, and charisma.

One way of generating values for these attributes is to roll four, 6-sided dice (d6) and sum the three highest rolls, discarding the lowest roll.

Some players like to assign values to their attributes in the order they're rolled.

To ensure generated characters don't put players at a disadvantage, the following requirements must be satisfied:

 The total of all character attributes must be at least 75.
 At least two of the attributes must be at least 15.

However, this can require a lot of manual dice rolling. A programatic solution would be much faster.



Task

Write a program that:

 Generates 4 random, whole values between 1 and 6.
 Saves the sum of the 3 largest values.
 Generates a total of 6 values this way.
 Displays the total, and all 6 values once finished.

 The order in which each value was generated must be preserved.
 The total of all 6 values must be at least 75.
 At least 2 of the values must be 15 or more.

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.