RPG attributes generator

From Rosetta Code
Revision as of 12:35, 19 July 2018 by rosettacode>Lonney (Created draft task page for "RPG Attributes Generator")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
RPG attributes generator is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

You're running a table-top RPG, and your players are creating characters.

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

One way of generating values for these attributes is to roll 4x 6-sided dice, taking the largest 3 results, and adding them together.

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

However, you want make sure that no player is at a disadvantage, so you specify the following conditions:

  • 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:

  1. Generates 4 random integer values between 1 and 6.
  2. Saves the sum of the 3 largest values.
  3. Generates a total of 6 values this way.
  4. Displays the the 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.