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

toCSVfunction

Rolls as CSV for a spreadsheet: a header, then a row for each roll, lines ended CRLF as RFC 4180 has them. total is empty for dice that are only words; dice is each die as text (see diceText); faces is the bare faces thrown; held is which dice were held, counted from 1; set is 2/6 for the second roll of six.

Import it

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

Definition

function toCSV(rolls: readonly Roll[]): string

Parameters

NameTypeDescription
rollsreadonly Roll[]

Completed rolls, or the number of attempts where this parameter is numeric.

Returns

string

Rolls as CSV for a spreadsheet: a header, then a row for each roll, lines ended CRLF as RFC 4180 has them. total is empty for dice that are only words; dice is each die as text (see diceText); faces is the bare faces thrown; held is which dice were held, counted from 1; set is 2/6 for the second roll of six.

Examples

import { toCSV } 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(toCSV([sample]).split("\r\n")[0]);
time,notation,label,total,dice,faces,seed,held,loaded,set

What it prints (run when this page was built)

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