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

formatNotationfunction

Notation for a spec: the inverse of parseNotation. One spelling for each roll: each kind of dice as its count and sides, !, the reroll as r< or ro<, what is kept as kh or kl; the kinds joined by +; then the bonus. So 4d6dl1 is written back as 4d6kh3.

Import it

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

Definition

function formatNotation(spec: RollSpec): string

Parameters

NameTypeDescription
specRollSpec

Dice counts, sides, rules and modifier; omitted fields use the documented defaults.

Returns

string

Notation for a spec: the inverse of parseNotation. One spelling for each roll: each kind of dice as its count and sides, !, the reroll as r< or ro<, what is kept as kh or kl; the kinds joined by +; then the bonus. So 4d6dl1 is written back as 4d6kh3.

Examples

import { formatNotation } from "@johnmorrisdotca/korokoro";
import { parseNotation } from "@johnmorrisdotca/korokoro";
console.log(formatNotation(parseNotation("2d20kh1+5")!));
2d20kh1+5

What it prints (run when this page was built)

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