32 lines
1.2 KiB
Text
32 lines
1.2 KiB
Text
'''RPG''' = <u>R</u>ole <u>P</u>laying <u>G</u>ame.
|
|
|
|
|
|
|
|
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.
|
|
<p></p>
|
|
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.
|
|
<p></p>
|
|
* 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.
|
|
<p></p>
|
|
|