Reference · Rolls and exact odds
evaluateMathfunction
What a formula comes to, given each kind's total. A sound formula (checkMath) always comes to a whole number.
Import it
import { evaluateMath } from "@johnmorrisdotca/korokoro";
Definition
function evaluateMath(node: MathNode, totals: readonly number[]): number
Parameters
| Name | Type | Description |
|---|---|---|
node | MathNode | The arithmetic expression tree. |
totals | readonly number[] | One total per dice group, in group order. |
Returns
number
What a formula comes to, given each kind's total. A sound formula (checkMath) always comes to a whole number.
Examples
import { evaluateMath } from "@johnmorrisdotca/korokoro";
console.log(evaluateMath({ kind: "dice", group: 0 }, [7]));7What it prints (run when this page was built)