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

readPresetfunction

Read a roll the way a game does. before is the rolls made just before it in the same game, oldest first, for a game that reads a roll in their light: the point in craps, a turn's total in Pig. language is "en" or "ja". The roll may be of other dice than the preset opens with (a pool made larger, a bonus added): it is read all the same.

Import it

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

Definition

function readPreset(preset: Preset, thrown: Roll, before?: readonly Roll[], language?: "en" | "ja"): PresetReading

Parameters

NameTypeDescription
presetPreset

The game preset whose dice and reading are used.

thrownRoll

The completed roll to read or announce.

before (optional)readonly Roll[]

Earlier rolls needed by a reading with a running result.

language (optional)"en" | "ja"

English or Japanese for the reading text.

Returns

PresetReading

Read a roll the way a game does. before is the rolls made just before it in the same game, oldest first, for a game that reads a roll in their light: the point in craps, a turn's total in Pig. language is "en" or "ja". The roll may be of other dice than the preset opens with (a pool made larger, a bonus added): it is read all the same.

Examples

import { readPreset } from "@johnmorrisdotca/korokoro";
import { getPreset, normalizeSpec, rollFrom } from "@johnmorrisdotca/korokoro";
const preset = getPreset("cho-han")!;
const spec = normalizeSpec({ count: 2, sides: 6 });
const sample = rollFrom(spec, [2, 5], "saved", 0, null)!;
console.log(readPreset(preset, sample, [], "en").text);
Han: 7 is odd

What it prints (run when this page was built)

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