本文へ移動

Korokoroコロコロ

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

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

目次

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

RollerHandle型

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

What mountRoller hands back: the tray, driven from code.

インポート

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

定義

type RollerHandle = {
    roll(): void;
    history(): readonly Roll[];
    setSpec(spec: Partial<RollSpec>): void;
    setLocale(locale: string): void;
    setCloth(cloth: Cloth): void;
    setOnePip(colour: "red" | "black"): void;
    destroy(): void;
};

メンバー

名前型説明
roll(): void

Throw the dice showing, as a tap on the felt does.

history(): readonly Roll[]

Every roll kept so far, oldest first.

setSpec(spec: Partial<RollSpec>): void

Change part of the dice, or all of them: a spec with its count, sides, bonus and keep all given, as parseNotation returns, replaces the lot.

setLocale(locale: string): void

Change the tray's language: "ja…" for Japanese, anything else for English, with strings still laid over it.

setCloth(cloth: Cloth): void

Lay the felt in another cloth, at once, keeping every die and roll: "green", "blue", "red", "black" or "wood".

setOnePip(colour: "red" | "black"): void

Change the colour of a d6's one pip at once: "red" or "black".

destroy(): void

Take the tray out of the page and stop its timers and its sound.

例

import type { RollerHandle } from "@johnmorrisdotca/korokoro";
import { mountRoller } from "@johnmorrisdotca/korokoro";
const value: RollerHandle = mountRoller(document.createElement("div"), { sound: false, storage: null });
console.log(value.history());

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

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