Fields:
Term terms are math expressions with some special format/operation tags.
Data is a list of key-value pairs, where the keys are used as constants in during the calculations. The format is JSON-like, but the quotes fir the keys are not needed. Normally the character attributes and skills are placed here. Example: K:5, KR:5, GW:9, WI:4, sneak:1, naturemagic:3
. The keys are always interpreted as lowercase (case insensitive), and only letters are allowed. Values are always numbers. During calculation, missing keys are assumed 0
.
Accumulate integrates the calculated relative frequency histogram, so that the rolled values (x-axis) are interpreted as "to roll N or less". Useful for Dungeon Masters and Devs to estimate/grasp where the limitations for checks are roughly located.
Threshold: Shows a threshold line at the y-axis for better visual inspection.
Deviation: Shows green areas of relative frequencies that are within the deviation
% highest results. For simple dice rolls with a lot of dice (say 30w6
), it is roughly comparable with the standard deviation of a normal distribution, so 68% is about 1 sigma.
Expressions and functionality:
The engine repeatedly calculates the given expression and records the absolute frequencies of the results by filling a histogram. After several iterations it calculates the relative frequencies and updates the histogram graph. It stops computing when the relative frequencies have tuned in (i.e. practically do not change anymore).
d
or w
represents a dice roll (Laplace distributed). d20
: Rolls one D20, 5w6
rolls five D6 and sums up values of all faces. Generalized: dF
or wF
is interpreted as a dice with F
faces, and the with the preceding number, NdF
or NwF
rolls N
such dice and sums up the value of all faces.
The keys in the data
field are constants.
Use paranthesis to group terms as in math, also definitely for expressions like (4+5)d6
, (K+G)d6
, tenery (see below), or max-constant-selection (K|G|I)
.
Use comparison operators to formualte checks:
(w20 + MN + trading) >= 18
: Trading/haggling check. The boolean results is interpreted numerically. Means the histogram will show two bars (0=x, 1=100%-x
).
Also accepted: <=
, <
, >
.
Implicitly replaced: =>
is the same as >=
, and =<
the same as <=
.
Logical operators AND
(&
) and OR
(|
) can be used:
((w20+kr)>20) | ((w20+gw)>20)
means that either the first or the second check (or both) must succeed. If so, the value 1
is counted in the histogram, a 0
if both fail.
((w20+kr)>20) & ((w20+gw)>20)
means that both checks must succeed to count a 1
in the histogram, otherwise a 0
is counted.
Special use (feature) of |
: If multiple constants are surrounded with parenthesis and separated with |
, the greatest value in the list is selected. E.g. a check where the player can choose (w20 + (GW|KR|GS)) >= 20
.
For programmers: &
is the same as &&
, |
is ||
.
Tenery operator (condition) ? (yes-value) : (no-value)
:
(d20+KR>18) ? 4w6 : 0
.: (no-value)
can be omitted. Equivalent to the above: (d20+KR>18) ? 4w6
.Success count operator/tag #
:
Success counting is to roll a "condition" (term with comparison operators) multiple times during one calculation and count the number of resulting 1
(true
) values; e.g. to count the number of rolled dices that show a 5 or 6. To formulate this, place parenthesis around the condition term and prefix the number of rolls followed by a hash: S#(condition)
.
E.g. 5#(w6>4)
rolls 5 dice per calculation and adds 1
to the result for each dice showing a 5 or 6. (GW)#(d6>=5)
rolls GW
dice, condition as before.
URL arguments:
During page initialization, URL parameters can be used to start the histogram calculation directly with given arguments. These simply are URL encoded, e.g.
histogram.html?debug=0&expression=3w6&accumulate=1&threshold=50
Keys are named after the visible fields. If a key is not given, the fiels is unchanged, that means initially the default value, or the last used value loaded from the browser local storage.
expression
(string
): Text placed in the expression field.data
(string
): Text placed in the data field.accumulate
(int
): Accumulate field, 0
or 1
.threshold
(int
): Threshold field, 0
to 100
.debug
(int
): Enable console log debug, values 0
(default) or 1
.---