Miscellaneous Applications¶
There are two applications to recapitulate interesting computations from the OpenD6 rules.
These are concrete confirmation of the math underlying the published tables.
die_simplification¶
Creates the Die Code Simplification table from first principles.
This script emits the published wild-die table:
Die Code |
5D |
Wild Die |
|---|---|---|
\(n\) |
\(\lfloor 0.5 + 3.5(n-5) \rfloor\) |
\(\lfloor 0.5 + 3.5(n-1) \rfloor\) |
Alternate¶
There might be slightly more accurate approach, but it doesn’t seem any more playable.
Any given die roll of \(n\) die has two components: Ordinary Die and Wild Die.
Ordinary Die. Average is \((n-1) \times 3.5\).
Wild Die. There are three possible outcomes.
- \(\frac{1}{6}\) Critical Failure. This can reduce the total.
The simplification however, doesn’t change the total. Die value is 1. Contribution to the total is about 0.17.
\(\frac{1}{6}\) Critical Success. Roll this Wild Die again, accumulating the values. There can be multiple re-rolls of the wild die.
\(\frac{5}{6}\) the re-roll is not 6. Expected value is \(\frac{1}{6} + (6 + 3\times\frac{5}{6}) = \frac{17}{12} \approx 1.42\).
\(\frac{1}{6} \times \frac{5}{6}\) the first re-roll is 6, the second is not 6. Expected value is \(\frac{1}{6}^2 \times (12 + 3\times\frac{5}{6}) = \frac{29}{72} \approx 0.4\).
\((\frac{1}{6})^3 \frac{5}{6}\) three re-rolls. Expected value is \(\frac{1}{6}^3 \times (18 + 3\times\frac{5}{6}) = \frac{41}{432} \approx 0.095\).
etc. \(\sum 6\times\frac{1}{6}^n = \frac{6}{5}\) for \(n\) re-rolls. Total is \(\frac{1}{6} (\frac{6}{5} + 3\times\frac{5}{6}) = \frac{27}{10} = 2.7\).
\(\frac{4}{6}\) Nothing Special. Die average is 3.5. Contribution to the total is about 2.3.
Total: \(\frac{31}{6} \approx 5.16\). This is too small a difference to justify the more complicated computation. Rolling \(n\) die seems to be \((n-1) \times 3.5 + \frac{31}{6}\).
Implementation¶
- opend6_tools.die_simplification.die_code(start: int = 1, stop: int = 51, step: int = 1) Iterator[tuple[str, str, str]][source]¶
Emits the sequence of die code simplifications as triples. (Die code, 5D, Wild Die).
- Parameters:
start – starting Die code (default 1)
stop – ending Die code (default 51)
step – step vvalue (default 1)
spell_measure¶
Creates the Spell Measures table from first principles.
Two cases:
Very first range has steps: 1, 1.5, 2.5, 3.5, 5.
Remaining ranges and bands have steps: 1, 1.5, 2, 2.5, 4, 6.
Both are essentially this.
However, the very first range and all the remaining ranges have slightly different decimal rounding rules.
The first five are
ROUND_CEILING.All the rest are
ROUND_HALF_UP.
The whole table has 3 ranges: \(\times 10^0\), \(\times 10^1\), and \(\times 10^2\), in 6 bands: “”, “,000”, “ million”, “ billion”, “ quadrillion”, “ quintillion”.
Implementation¶
- opend6_tools.spell_measure.value_measure() Iterator[tuple[Decimal, str]][source]¶
Emits the sequence of game values and the source measures.
- opend6_tools.spell_measure.main(rows: int = 35) None[source]¶
Produce CSV-formatted table of Spell Measures.
The number of rows defines the format.
For 100 rows, the table is in a single pair of columns.
For less than 100 rows, the table is split into columns to meet the row constraint. The published table has 35 rows, therefore, this is the default.