本文へ移動

Korokoroコロコロ

ダイスを組み合わせて振り、ダイス表記を読み取り、正確な確率を調べます。履歴の保存やシードを指定した再現もできます。

「コロコロ」は、小さなものが転がる様子を表す言葉です。 名前について(英語)

目次

リファレンス · ロールと正確な確率

ExportedRoll型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

One roll as the JSON export writes it.

インポート

import type { ExportedRoll } from "@johnmorrisdotca/korokoro";

定義

type ExportedRoll = {
    id: string;
    notation: string;
    spec: Roll["spec"];
    faces: number[];
    kept: boolean[];
    total: number;
    successes?: true;
    words?: string[];
    at: number;
    time: string;
    seed: string | null;
    held?: boolean[];
    loaded?: true;
    set?: Roll["set"];
    dice: DieRoll[];
};

メンバー

名前型説明
idstring
notationstring

The dice as notation, its label included.

specRollSpec

The same dice as a spec: what fromJSON reads.

facesnumber[]

Every die thrown, in the order thrown.

keptboolean[]

Which faces count.

totalnumber
successes (省略可)true | undefined

True when the total is a count of successes. Left out otherwise.

words (省略可)string[] | undefined

What the faces say, on a roll of custom dice. Left out otherwise.

atnumber

Epoch milliseconds, and the same moment as ISO 8601 in UTC.

timestring
seedstring | null
held (省略可)boolean[] | undefined
loaded (省略可)true | undefined
set (省略可){ id: string; index: number; of: number; } | undefined
diceDieRoll[]

What became of each die.

例

import type { ExportedRoll } from "@johnmorrisdotca/korokoro";
import { DEFAULT_SPEC, rollFrom, exportedRoll } from "@johnmorrisdotca/korokoro";
const value: ExportedRoll = exportedRoll(rollFrom(DEFAULT_SPEC, [2, 5], "saved", 0, null)!);
console.log(value.total);
7

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/korokoro 1.16.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。