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

Statstype

Everything worth saying about a history of rolls. Pure: a history in, numbers out.

Import it

import type { Stats } from "@johnmorrisdotca/korokoro";

Definition

type Stats = {
    rolls: number;
    heldRolls: number;
    diceThrown: number;
    luck: number | null;
    longestHot: number;
    longestCold: number;
    currentStreak: number;
    matches: number;
    naturalTwenties: number;
    naturalOnes: number;
    faces: FaceStats | null;
    totals: TotalStats | null;
};

Members

NameTypeDescription
rollsnumber

How many rolls the history holds.

heldRollsnumber

How many of those rolls held some dice from the roll before. They count their new dice, and are left out of luck, streaks, matches and totals.

diceThrownnumber

How many dice those rolls threw, rerolled and exploded dice included, held dice not.

lucknumber | null

Mean of each roll's luck (0 to 1); 0.5 is exactly as lucky as the dice promise. Null with no rolls.

longestHotnumber

The longest run of rolls above their average, and below it.

longestColdnumber
currentStreaknumber

The run the history ends on: positive above average, negative below, 0 on the average.

matchesnumber

Rolls of two or more dice all showing the same face. A roll that rerolled or exploded a die is not counted.

naturalTwentiesnumber

A d20's natural 20 and natural 1, counted on the dice that were kept.

naturalOnesnumber
facesFaceStats | null

Each face of the focus die. Null when no focus was given.

totalsTotalStats | null

The totals of the focus spec. Null when no focus was given.

Examples

import type { Stats } from "@johnmorrisdotca/korokoro";
import { statsOf } from "@johnmorrisdotca/korokoro";
const value: Stats = statsOf([]);
console.log(value.rolls);
0

What it prints (run when this page was built)

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