本文へ移動

Korokoroコロコロ

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

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

目次

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

DiceWarGame型

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

A game of Dice War: its table, seed and moves (what is kept), and what they make.

インポート

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

定義

type DiceWarGame = {
    players: string[];
    computers: boolean[];
    dice: number;
    sides: number;
    goal: DiceWarGoal;
    to: number;
    seed: string;
    moves: DiceWarMove[];
    phase: "playing" | "over";
    scores: number[];
    round: number;
    wars: number;
    stake: number;
    rollers: number[];
    throws: DiceWarThrow[];
    ended: DiceWarGoal | null;
};

メンバー

名前型説明
playersstring[]
computersboolean[]
dicenumber
sidesnumber
goalDiceWarGoal
tonumber
seedstring
movesDiceWarMove[]

Every move so far, in order.

phase"playing" | "over"
scoresnumber[]

Each seat's points.

roundnumber

The round being played, from 1; once over, the round it ended in.

warsnumber

How many wars the round has been through.

stakenumber

The points at stake in this round now: 1, and one more for each war.

rollersnumber[]

The seats that roll next: everybody, or in a war those who tied.

throwsDiceWarThrow[]

Every throw so far, oldest first.

endedDiceWarGoal | null

Why the game ended: a player reached the score ("points"), or the rounds ran out ("rounds"). Null while it goes on.

例

import type { DiceWarGame } from "@johnmorrisdotca/korokoro";
import { startDiceWar } from "@johnmorrisdotca/korokoro";
const value: DiceWarGame = startDiceWar({ players: ["One", "Two"], computers: [true, true], seed: "docs" })!;
console.log(value.phase);
playing

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

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

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