Reference · Rolls and exact odds
DiceWarGametype
A game of Dice War: its table, seed and moves (what is kept), and what they make.
Import it
import type { DiceWarGame } from "@johnmorrisdotca/korokoro";
Definition
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;
};
Members
| Name | Type | Description |
|---|---|---|
players | string[] | |
computers | boolean[] | |
dice | number | |
sides | number | |
goal | DiceWarGoal | |
to | number | |
seed | string | |
moves | DiceWarMove[] | Every move so far, in order. |
phase | "playing" | "over" | |
scores | number[] | Each seat's points. |
round | number | The round being played, from 1; once over, the round it ended in. |
wars | number | How many wars the round has been through. |
stake | number | The points at stake in this round now: 1, and one more for each war. |
rollers | number[] | The seats that roll next: everybody, or in a war those who tied. |
throws | DiceWarThrow[] | Every throw so far, oldest first. |
ended | DiceWarGoal | null | Why the game ended: a player reached the score ( |
Examples
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);playingWhat it prints (run when this page was built)