本文へ移動

Korokoroコロコロ

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

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

目次

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

readPreset関数

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

Read a roll the way a game does. before is the rolls made just before it in the same game, oldest first, for a game that reads a roll in their light: the point in craps, a turn's total in Pig. language is "en" or "ja". The roll may be of other dice than the preset opens with (a pool made larger, a bonus added): it is read all the same.

インポート

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

定義

function readPreset(preset: Preset, thrown: Roll, before?: readonly Roll[], language?: "en" | "ja"): PresetReading

引数

名前型説明
presetPreset

The game preset whose dice and reading are used.

thrownRoll

The completed roll to read or announce.

before (省略可)readonly Roll[]

Earlier rolls needed by a reading with a running result.

language (省略可)"en" | "ja"

English or Japanese for the reading text.

戻り値

PresetReading

Read a roll the way a game does. before is the rolls made just before it in the same game, oldest first, for a game that reads a roll in their light: the point in craps, a turn's total in Pig. language is "en" or "ja". The roll may be of other dice than the preset opens with (a pool made larger, a bonus added): it is read all the same.

例

import { readPreset } from "@johnmorrisdotca/korokoro";
import { getPreset, normalizeSpec, rollFrom } from "@johnmorrisdotca/korokoro";
const preset = getPreset("cho-han")!;
const spec = normalizeSpec({ count: 2, sides: 6 });
const sample = rollFrom(spec, [2, 5], "saved", 0, null)!;
console.log(readPreset(preset, sample, [], "en").text);
Han: 7 is odd

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

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

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