Reference · Rolls and exact odds
encodeDiceWarfunction
A game of Dice War as text: its table, its seed and its moves, which is all there is to keep.
Import it
import { encodeDiceWar } from "@johnmorrisdotca/korokoro";
Definition
function encodeDiceWar(game: DiceWarGame): string
Parameters
| Name | Type | Description |
|---|---|---|
game | DiceWarGame | The current Dice War state. |
Returns
string
A game of Dice War as text: its table, its seed and its moves, which is all there is to keep.
Examples
import { encodeDiceWar } 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(encodeDiceWar(game));{"v":1,"g":"diceWar","players":["One","Two"],"computers":[true,true],"dice":1,"sides":6,"goal":"rounds","to":1,"seed":"table","moves":[]}What it prints (run when this page was built)