本文へ移動

Korokoroコロコロ

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

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

目次

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

checkMath関数

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

Whether a formula can be used with kinds of dice whose totals run over these ranges: the problem, or null when there is none. It has to name each kind exactly once (so the kinds stay independent and the odds exact), come to a whole number, never divide by nothing, and stay small enough to count.

インポート

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

定義

function checkMath(node: MathNode, ranges: readonly { min: number; max: number; }[]): MathProblem | null

引数

名前型説明
nodeMathNode

The arithmetic expression tree.

rangesreadonly { min: number; max: number; }[]

The minimum and maximum for each dice group.

戻り値

MathProblem | null

Whether a formula can be used with kinds of dice whose totals run over these ranges: the problem, or null when there is none. It has to name each kind exactly once (so the kinds stay independent and the odds exact), come to a whole number, never divide by nothing, and stay small enough to count.

例

import { checkMath } from "@johnmorrisdotca/korokoro";
console.log(checkMath({ kind: "dice", group: 0 }, [{ min: 1, max: 6 }]));
null

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

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

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