本文へ移動

Korokoroコロコロ

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

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

目次

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

Stats型

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

Everything worth saying about a history of rolls. Pure: a history in, numbers out.

インポート

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

定義

type Stats = {
    rolls: number;
    heldRolls: number;
    diceThrown: number;
    luck: number | null;
    longestHot: number;
    longestCold: number;
    currentStreak: number;
    matches: number;
    naturalTwenties: number;
    naturalOnes: number;
    faces: FaceStats | null;
    totals: TotalStats | null;
};

メンバー

名前型説明
rollsnumber

How many rolls the history holds.

heldRollsnumber

How many of those rolls held some dice from the roll before. They count their new dice, and are left out of luck, streaks, matches and totals.

diceThrownnumber

How many dice those rolls threw, rerolled and exploded dice included, held dice not.

lucknumber | null

Mean of each roll's luck (0 to 1); 0.5 is exactly as lucky as the dice promise. Null with no rolls.

longestHotnumber

The longest run of rolls above their average, and below it.

longestColdnumber
currentStreaknumber

The run the history ends on: positive above average, negative below, 0 on the average.

matchesnumber

Rolls of two or more dice all showing the same face. A roll that rerolled or exploded a die is not counted.

naturalTwentiesnumber

A d20's natural 20 and natural 1, counted on the dice that were kept.

naturalOnesnumber
facesFaceStats | null

Each face of the focus die. Null when no focus was given.

totalsTotalStats | null

The totals of the focus spec. Null when no focus was given.

例

import type { Stats } from "@johnmorrisdotca/korokoro";
import { statsOf } from "@johnmorrisdotca/korokoro";
const value: Stats = statsOf([]);
console.log(value.rolls);
0

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

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

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