Reference · Rolls and exact odds
dieOutcomesfunction
One die of a kind worked through its own rules, before any keeping or
dropping: the chance of each amount it adds to the total, from least up.
For dice that are added, that is what the die is worth, explosions and all;
for dice that are counted, it is the successes it makes less the ones it
takes away. Exact as the rules are played: rerolls stop after
MAX_REROLLS and explosions after MAX_EXPLOSIONS, here as in a roll.
Import it
import { dieOutcomes } from "@johnmorrisdotca/korokoro";
Definition
function dieOutcomes(group: DiceGroup): { least: number; chances: number[]; }
Parameters
| Name | Type | Description |
|---|---|---|
group | DiceGroup | One kind of dice and its rules. |
Returns
{ least: number; chances: number[]; }
One die of a kind worked through its own rules, before any keeping or dropping: the chance of each amount it adds to the total, from least up. For dice that are added, that is what the die is worth, explosions and all; for dice that are counted, it is the successes it makes less the ones it takes away. Exact as the rules are played: rerolls stop after MAX_REROLLS and explosions after MAX_EXPLOSIONS, here as in a roll.
Examples
import { dieOutcomes } from "@johnmorrisdotca/korokoro";
import { normalizeSpec } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
console.log(dieOutcomes(spec));{
least: 1,
chances: [
0.16666666666666666,
0.16666666666666666,
0.16666666666666666,
0.16666666666666666,
0.16666666666666666,
0.16666666666666666
]
}What it prints (run when this page was built)