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

statsOffunction

Stats for a history, oldest roll first. focus picks which spec's totals to break down, and which die's faces: its first kind, or sides when a roll of several kinds wants another.

Import it

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

Definition

function statsOf(history: readonly Roll[], focus?: RollSpec, sides?: Sides | DiceGroup): Stats

Parameters

NameTypeDescription
historyreadonly Roll[]

Completed rolls, newest first where the history API requires it.

focus (optional)RollSpec | undefined

The spec whose totals are measured.

sides (optional)DiceGroup | Sides | undefined

A numbered die size or F for Fate dice.

Returns

Stats

Stats for a history, oldest roll first. focus picks which spec's totals to break down, and which die's faces: its first kind, or sides when a roll of several kinds wants another.

Examples

import { statsOf } from "@johnmorrisdotca/korokoro";
import { normalizeSpec, rollFrom } from "@johnmorrisdotca/korokoro";
const spec = normalizeSpec({ count: 2, sides: 6 });
const sample = rollFrom(spec, [2, 5], "saved", 0, null)!;
console.log(statsOf([sample]).rolls);
1

What it prints (run when this page was built)

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