diceWarComputerFaces関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A computer's dice for a throw: from the game's seed, the round, the war and the seat, so the same game always rolls the same.
インポート
import { diceWarComputerFaces } from "@johnmorrisdotca/korokoro";
定義
function diceWarComputerFaces(game: Pick<DiceWarGame, "seed" | "dice" | "sides">, round: number, war: number, seat: number): number[]
引数
| 名前 | 型 | 説明 |
|---|---|---|
game | Pick<DiceWarGame, "dice" | "sides" | "seed"> | The current Dice War state. |
round | number | The round number used by the deterministic computer roll. |
war | number | The tied-throw number within that round. |
seat | number | The player seat whose computer faces are requested. |
戻り値
number[]
A computer's dice for a throw: from the game's seed, the round, the war and the seat, so the same game always rolls the same.
例
import { diceWarComputerFaces } from "@johnmorrisdotca/korokoro";
import { startDiceWar } from "@johnmorrisdotca/korokoro";
const game = startDiceWar({ players: ["One", "Two"], computers: [true, true], goal: "rounds", to: 1, seed: "table" })!;
console.log(diceWarComputerFaces(game, 1, 0, 0));[ 1 ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。