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

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

NameTypeDescription
gamePick<DiceWarGame, "dice" | "sides" | "seed">

The current Dice War state.

roundnumber

The round number used by the deterministic computer roll.

warnumber

The tied-throw number within that round.

seatnumber

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)

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