Reference · Rolls and exact odds
diceWarComputerFacesfunction
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 it
import { diceWarComputerFaces } from "@johnmorrisdotca/korokoro";
Definition
function diceWarComputerFaces(game: Pick<DiceWarGame, "seed" | "dice" | "sides">, round: number, war: number, seat: number): number[]
Parameters
| Name | Type | Description |
|---|---|---|
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. |
Returns
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.
Examples
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 ]What it prints (run when this page was built)