Reference · Rolls and exact odds
Presettype
The dice for a game, and how the game reads them. A preset is data: a line here, not code. Korokoro rolls and reads the dice; it does not run the game (whose turn it is, a score sheet across rounds).
Import it
import type { Preset } from "@johnmorrisdotca/korokoro";
Definition
type Preset = {
id: string;
name: string;
nameJa: string;
aliases: string[];
family: GameFamily;
notation: string;
reading: ReadingId;
options?: Record<string, number>;
total: boolean;
rolls?: number;
hold?: false;
runs?: true;
says: string;
saysJa: string;
how: string;
source?: string;
};
Members
| Name | Type | Description |
|---|---|---|
id | string | A short name for code, links and the command line: "yahtzee", "cho-han". |
name | string | What people call the game. |
nameJa | string | The same in Japanese, for the tray. |
aliases | string[] | Other names it is found by: an older or public-domain name, a name in another language. |
family | GameFamily | |
notation | string | The dice, as notation. |
reading | "successes" | "faces" | "sum" | "doubles" | "robber" | "backgammon" | "sixAgain" | "cowries" | "craps" | "hazard" | "yahtzee" | "pokerDice" | "farkle" | "scores" | "bunco" | "pig" | "counts" | "shipCaptainCrew" | "shutTheBox" | "mexico" | "sicBo" | "choHan" | "chinchirorin" | "risk" | "highest" | "d20" | "fate" | "bladesPool" | "pbta" | "hitsAndGlitch" | "percentile" | "rollUnder" | "d66" | How a roll is read: one of the named readings. |
options (optional) | Record<string, number> | undefined | Figures a reading needs: a pool's target number, a game's main. |
total | boolean | Whether the total is what matters. False where the reading is the result, as in Yahtzee or chō-han. |
rolls (optional) | number | undefined | How many rolls a turn has when dice are held between them: 3 for Yahtzee. Left out when a turn is one roll. |
hold (optional) | false | undefined | False where holding a die and rolling the rest is no part of the game, as in craps or Monopoly: the tray then holds nothing. Left out where dice are held between rolls (Yahtzee, Farkle). |
runs (optional) | true | undefined | True where a roll is read in the light of the rolls before it: the point in craps, a turn's total in Pig. |
says | string | What it is, in a line. |
saysJa | string | The same in Japanese. |
how | string | How the dice are used in the game, in a few sentences of our own. |
source (optional) | string | undefined | Where the rule can be read. Left out of a preset that has no rule to cite, such as a coin. |
Examples
import type { Preset } from "@johnmorrisdotca/korokoro";
import { getPreset } from "@johnmorrisdotca/korokoro";
const value: Preset = getPreset("cho-han")!;
console.log(value.notation);2d6What it prints (run when this page was built)