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

How-to

Mount and embed a table

Mount a table in the DOM or as a custom element, and keep private names out of events and frames.

Mount the DOM table

import {mountTenka} from "@johnmorrisdotca/tenka/ui";
const host = document.createElement("div");
document.body.append(host);
const table = mountTenka(host,{seed:42,players:["Seat 1","Seat 2"],computers:[false,false],record:false});
console.log(table.game().seed);
table.destroy();

Destroy the handle on unmount to release listeners and pending computer work. setGame restores a native game; newGame starts a new deal. The React TenkaTable wraps that lifecycle. Set computerDelayMs for presentation, not game rules.

Use the custom element

import {defineTable,TenkaTable} from "@johnmorrisdotca/tenka/element";
defineTable();
const table = document.createElement("tenka-table") as TenkaTable;
table.options = {seed:42,players:["Seat 1","Seat 2"],computers:[false,false],record:false};
document.body.append(table);
console.log(table.game?.seed);

The registration entry defines the default tag as a side effect. Attribute setup accepts seed, seats, computers, rounds, map, language, record, delay, daily and display settings. Host options accept private names, word overrides, custom palettes, drawing callbacks and local change callbacks.

Check privacy and transport

Frames read no storage; the builder shares seat count and public settings. tenka-change/tenka-load expose JSON-safe game-shaped copies with generic seat names; the local game getter and onChange retain the host's names. Validate message source and origin in parents. The embed guide contains every attribute, event and frame message; keep it as the integration contract.

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