本文へ移動

Korokoroコロコロ

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

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

目次

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

Fairness型

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

What a fairness test makes of a die.

インポート

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

定義

type Fairness = {
    sides: number;
    rolls: number;
    minimum: number;
    enough: boolean;
    expected: number[];
    statistic: number | null;
    p: number | null;
    verdict: "too-few" | "fair" | "unusual" | "lopsided";
};

メンバー

名前型説明
sidesnumber

How many faces the die has.

rollsnumber

How many throws were counted.

minimumnumber

How many throws the test wants before it will pronounce: five for each face.

enoughboolean

Whether there were that many.

expectednumber[]

How often each face should have come up, if the die is what it is tested against.

statisticnumber | null

The chi-square statistic: how far the counts stray from that, in all. Null with too few throws.

pnumber | null

The chance that a die as supposed strays this far or further. Null with too few throws: never a guess.

verdict"fair" | "too-few" | "unusual" | "lopsided"

The reading. too-few: no verdict. fair: nothing to see (p of 5% or more). unusual: lopsided enough to happen less than one time in twenty by chance, which still happens one time in twenty. lopsided: less than one time in a thousand.

例

import type { Fairness } from "@johnmorrisdotca/korokoro";
import { fairnessTest } from "@johnmorrisdotca/korokoro";
const value: Fairness = fairnessTest([30, 30, 30, 30, 30, 30]);
console.log(value.enough);
true

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

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

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