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

presetOddsfunction

The exact odds of each outcome of a game's first roll: a natural in craps, each hand in chinchirorin, each result of a Risk battle. Every way the dice can fall is counted, in whole numbers. spec is the preset's own dice unless others are given (a larger pool, fewer battle dice).

Null where there is nothing to count: a reading that is only the total, whose odds distributionOf gives; a reading that depends on the order of the dice; or dice that are rerolled or explode.

Import it

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

Definition

function presetOdds(preset: Preset, spec?: RollSpec, language?: "en" | "ja"): OutcomeOdds[] | null

Parameters

NameTypeDescription
presetPreset

The game preset whose dice and reading are used.

spec (optional)RollSpec

Dice counts, sides, rules and modifier; omitted fields use the documented defaults.

language (optional)"en" | "ja"

English or Japanese for the reading text.

Returns

OutcomeOdds[] | null

The exact odds of each outcome of a game's first roll: a natural in craps, each hand in chinchirorin, each result of a Risk battle. Every way the dice can fall is counted, in whole numbers. spec is the preset's own dice unless others are given (a larger pool, fewer battle dice). null where there is nothing to count: a reading that is only the total, whose odds distributionOf gives; a reading that depends on the order of the dice; or dice that are rerolled or explode.

Examples

import { presetOdds } from "@johnmorrisdotca/korokoro";
import { getPreset } from "@johnmorrisdotca/korokoro";
const preset = getPreset("cho-han")!;
console.log(presetOdds(preset)?.map((outcome) => outcome.text));
[ 'Chō (even)', 'Han (odd)' ]

What it prints (run when this page was built)

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