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

readResultsfunction

Results typed or pasted from a real die, such as 3 5 6 6 1 or 3,5,6: whole numbers separated by spaces, commas or new lines. sides is the die; left out, it is taken to be the highest face seen, and at least 2. Says which piece it could not read.

Import it

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

Definition

function readResults(text: string, sides?: number): TypedResults

Parameters

NameTypeDescription
textstring

Text to parse, validate or format.

sides (optional)number | undefined

A numbered die size or F for Fate dice.

Returns

TypedResults

Results typed or pasted from a real die, such as 3 5 6 6 1 or 3,5,6: whole numbers separated by spaces, commas or new lines. sides is the die; left out, it is taken to be the highest face seen, and at least 2. Says which piece it could not read.

Examples

import { readResults } from "@johnmorrisdotca/korokoro";
console.log(readResults("1 2 3 4 5 6", 6));
{ ok: true, sides: 6, counts: [ 1, 1, 1, 1, 1, 1 ], rolls: 6 }

What it prints (run when this page was built)

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