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

soundMathfunction

A formula given by hand, checked for its shape alone: the nodes are what they say they are. Undefined when it is not a formula.

Import it

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

Definition

function soundMath(given: unknown, depth?: number): MathNode | undefined

Parameters

NameTypeDescription
givenunknown

The candidate arithmetic tree to validate.

depth (optional)number

The current recursive depth; normally omitted.

Returns

MathNode | undefined

A formula given by hand, checked for its shape alone: the nodes are what they say they are. undefined when it is not a formula.

Examples

import { soundMath } from "@johnmorrisdotca/korokoro";
console.log(soundMath({ kind: "dice", group: 0 }));
{ kind: 'dice', group: 0 }

What it prints (run when this page was built)

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