presetOdds関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The exact odds of each outcome of a game's first roll: a natural in craps,
each hand in chinchirorin, each result of a Risk battle. Every way the dice
can fall is counted, in whole numbers. spec is the preset's own dice
unless others are given (a larger pool, fewer battle dice).
Null where there is nothing to count: a reading that is only the total,
whose odds distributionOf gives; a reading that depends on the order of
the dice; or dice that are rerolled or explode.
インポート
import { presetOdds } from "@johnmorrisdotca/korokoro";
定義
function presetOdds(preset: Preset, spec?: RollSpec, language?: "en" | "ja"): OutcomeOdds[] | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
preset | Preset | The game preset whose dice and reading are used. |
spec (省略可) | RollSpec | Dice counts, sides, rules and modifier; omitted fields use the documented defaults. |
language (省略可) | "en" | "ja" | English or Japanese for the reading text. |
戻り値
OutcomeOdds[] | null
The exact odds of each outcome of a game's first roll: a natural in craps, each hand in chinchirorin, each result of a Risk battle. Every way the dice can fall is counted, in whole numbers. spec is the preset's own dice unless others are given (a larger pool, fewer battle dice). null where there is nothing to count: a reading that is only the total, whose odds distributionOf gives; a reading that depends on the order of the dice; or dice that are rerolled or explode.
例
import { presetOdds } from "@johnmorrisdotca/korokoro";
import { getPreset } from "@johnmorrisdotca/korokoro";
const preset = getPreset("cho-han")!;
console.log(presetOdds(preset)?.map((outcome) => outcome.text));[ 'Chō (even)', 'Han (odd)' ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。