Skip to the content

Korokoroコロコロ

Roll mixed dice or type notation, compare exact probabilities, keep a history and replay seeded rolls.

Korokoro describes something small rolling in Japanese. About the name

Contents

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

NameTypeDescription
gameDiceWarGame

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)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/korokoro 1.16.0.