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.

100 rem rpg character roller
110 rem rosetta code - commodore basic
120 dim di(3):rem dice
130 dim at(5),at$(5):rem attributes as follows:
140 at$(0)="Strength"
150 at$(1)="Dexterity"
160 at$(2)="Constitution"
170 at$(3)="Intelligence"
180 at$(4)="Wisdom"
190 at$(5)="Charisma"
200 pt=0:sa=0:rem points total and number of strong attributes (15+)
210 print chr$(147);chr$(14);chr$(29);chr$(17);"Rolling..."
220 for ai=0 to 5:rem attribute index
230 for i=0 to 3:di(i)=int(rnd(.)*6)+1:next i
240 gosub 450
250 dt=0:rem dice total
260 for i=0 to 2:dt=dt+di(i):next i:rem take top 3
270 at(ai)=dt:pt=pt+dt
280 if dt>=15 then sa=sa+1
290 next ai
300 if pt<75 or sa<2 then goto 200
310 print chr$(147);"Character Attributes:"
320 print
330 for ai=0 to 5
340 print spc(13-len(at$(ai)));at$(ai);":";tab(14);at(ai)
350 next ai
360 print
370 print "        Total:";tab(14);pt
380 print
390 print "Do you accept? ";
400 get k$:if k$<>"y" and k$<>"n" then 400
410 print k$
420 if k$="n" then goto 200
430 print:print "Excellent. Good luck on your adventure!"
440 end
450 rem "sort" dice - really just put smallest one last
460 for x=0 to 2
470 if di(x)<di(x+1) then t=di(x):di(x)=di(x+1):di(x+1)=t
480 next x
490 return