Reference · Rolls and exact odds
diceWarWinnersfunction
The seats that won a game that is over: the player who reached the score, or the most points when the rounds ran out, shared where level. Nobody while it goes on.
Import it
import { diceWarWinners } from "@johnmorrisdotca/korokoro";
Definition
function diceWarWinners(game: DiceWarGame): number[]
Parameters
| Name | Type | Description |
|---|---|---|
game | DiceWarGame | The current Dice War state. |
Returns
number[]
The seats that won a game that is over: the player who reached the score, or the most points when the rounds ran out, shared where level. Nobody while it goes on.
Examples
import { diceWarWinners } from "@johnmorrisdotca/korokoro";
import { diceWarOver, playDiceWar, startDiceWar } from "@johnmorrisdotca/korokoro";
const game = startDiceWar({ players: ["One", "Two"], computers: [true, true], goal: "rounds", to: 1, seed: "table" })!;
let current = game;
while (!diceWarOver(current)) current = playDiceWar(current, {})!;
console.log(diceWarWinners(current));[ 1 ]What it prints (run when this page was built)