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

PresetReadingtype

What a game makes of a roll: the outcome, and the words for it.

Import it

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

Definition

type PresetReading = Outcome & {
    text: string;
};

Members

NameTypeDescription
outcomestring

The outcome's name within its reading: "natural", "point", "yahtzee".

valuesRecord<string, string | number>

The figures the outcome's words are filled in with.

tone"good" | "bad" | "plain"

Whether it is good news, bad news or neither, for a tray to colour.

textstring

The reading in a sentence, in English. Empty for a die that says it all itself, such as a coin.

Examples

import type { PresetReading } from "@johnmorrisdotca/korokoro";
import { getPreset, presetSpec, roll, seededSource, readPreset } from "@johnmorrisdotca/korokoro";
const value: PresetReading = readPreset(getPreset("cho-han")!, roll(presetSpec(getPreset("cho-han")!), seededSource("docs"), 0));
console.log(value.text);
Han: 3 is odd

What it prints (run when this page was built)

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