Skip to the content

Tenka天下

Play seeded world conquest for two to six, with dice battles, cards, computer players and saved games.

Tenka means the world under heaven in Japanese. About the name

Contents

Reference · Browser table and SVG

TenkaTableHandletype

Native game access, restoration, redealing and presentation updates.

Import it

import type { TenkaTableHandle } from "@johnmorrisdotca/tenka/ui";

Definition

type TenkaTableHandle = {
    game: () => TenkaGame;
    newGame: (options?: Pick<TenkaTableOptions, "players" | "computers" | "rounds" | "seed" | "map">) => void;
    setGame: (game: TenkaGame, computers?: readonly boolean[]) => void;
    setLocale: (locale: TenkaLocale, strings?: Partial<TenkaStrings>) => void;
    set: (options: Pick<TenkaTableOptions, "locale" | "strings" | "theme" | "record" | "dressing" | "colours" | "computerDelayMs" | "onChange">) => void;
    destroy: () => void;
};

Members

NameTypeDescription
game() => TenkaGame

The game as it stands.

newGame(options?: Pick<TenkaTableOptions, "players" | "computers" | "rounds" | "seed" | "map">) => void

A new game at the same table, with any options changed.

setGame(game: TenkaGame, computers?: readonly boolean[]) => void

Put a game on the table: one read back by tenkaFromJSON or decodeTenka. Seats keep who plays them when the number of players is the same; otherwise every seat but the first is the computer's, unless computers says.

setLocale(locale: TenkaLocale, strings?: Partial<TenkaStrings>) => void

Change the table's language, and with it any words of your own.

set(options: Pick<TenkaTableOptions, "locale" | "strings" | "theme" | "record" | "dressing" | "colours" | "computerDelayMs" | "onChange">) => void

Update presentation and callbacks without redealing or replacing the current game.

destroy() => void

Take the table off the page and stop its timers.

Examples

import type { TenkaTableHandle } from "@johnmorrisdotca/tenka/ui";
const update = (table: TenkaTableHandle) => table.set({ locale: "ja" });
console.log(typeof update);
function

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tenka 2.2.0.