Skip to the content

Korokoroコロコロ

Roll mixed dice or type notation, compare exact probabilities, keep a history and replay seeded rolls.

Korokoro describes something small rolling in Japanese. About the name

Contents

Reference · Rolls and exact odds

checkMathfunction

Whether a formula can be used with kinds of dice whose totals run over these ranges: the problem, or null when there is none. It has to name each kind exactly once (so the kinds stay independent and the odds exact), come to a whole number, never divide by nothing, and stay small enough to count.

Import it

import { checkMath } from "@johnmorrisdotca/korokoro";

Definition

function checkMath(node: MathNode, ranges: readonly { min: number; max: number; }[]): MathProblem | null

Parameters

NameTypeDescription
nodeMathNode

The arithmetic expression tree.

rangesreadonly { min: number; max: number; }[]

The minimum and maximum for each dice group.

Returns

MathProblem | null

Whether a formula can be used with kinds of dice whose totals run over these ranges: the problem, or null when there is none. It has to name each kind exactly once (so the kinds stay independent and the odds exact), come to a whole number, never divide by nothing, and stay small enough to count.

Examples

import { checkMath } from "@johnmorrisdotca/korokoro";
console.log(checkMath({ kind: "dice", group: 0 }, [{ min: 1, max: 6 }]));
null

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/korokoro 1.16.0.