Skip to the content

Tenka documentation

Tenka API: every export

Every export of every entry point, each with its own page. This page keeps the addresses the old one-page reference had.

@johnmorrisdotca/tenka/shapes

TENKA_EUROPE_SHAPESconstant

How Tenka's Europe is drawn: Miller's projection from 12°W to 44°E and 31°N to 66.5°N, 2000 by 1672 units.

TENKA_SHAPESconstant

How Tenka's world is drawn: Miller's projection from 170°W round to 192°E, 2000 by 984 units.

TenkaShapestype

How the world is drawn, in map units (tenkaShapes.data.ts, written by scripts/map.mjs).

@johnmorrisdotca/tenka/ui

Clothtype

A cloth's name.

clothVarsfunction

A cloth as CSS variables; nothing for a name that is not a cloth, so the defaults stay.

continentNameInfunction

A continent's name in a table of strings, by its key ("northAmerica", "asia"…).

continentViewfunction

The part of the map that frames a continent, with a margin, widened to the map's own shape so it fills the same box; the whole world for null.

isClothfunction

Whether a text names a cloth.

landInDirectionfunction

The territory a key moves to from another: the nearest counter in that direction, a little straighter being better than a little nearer, and only among those inside view (the whole map when none is given), so that the focus never leaves what is on the screen.

mountTenkafunction

A WHOLE TABLE OF TENKA IN PLAIN DOM: the map, whose turn it is and what to do, the players, your cards and the last dice, played against the computer (or by people taking turns on one device, with computers all false).

nearestLandfunction

The territory whose counter is nearest a point of the map, within reach map units, or null.

ownerColourfunction

The colour a territory's owner is drawn in.

TENKA_CLOTHSconstant

THE CLOTHS A TABLE MAY BE LAID IN: the same five the whole family offers, and itsutsu.com's boards: green, blue, red, black and wood.

TENKA_SEAT_COLOURSconstant

THE COLOURS A TABLE IS DRAWN IN: one for each of six seats, and a grey for the neutral army that holds a third of the world in a game for two.

TENKA_STRINGSconstant

The package's words in each language it speaks: TENKA_STRINGS.en, TENKA_STRINGS.ja.

TENKA_STYLEconstant

The table's own styles, scoped to .tk-root, with every colour a CSS variable so a page can wear it in its own colours (set them on the element or any ancestor, or pass them as theme).

TenkaArrowtype

A way to move between territories from a keyboard.

TenkaBackHowtype

What a dressing is told about the back it is asked to draw.

TenkaCardHowtype

What a dressing is told about a card it is asked to draw.

tenkaCountfunction

A count said in the singular when it is one and the plural otherwise: tenkaCount(strings.countCardsOne, strings.countCards, 1) is "1 card".

TenkaDieHowtype

What a dressing is told about a die it is asked to draw.

TenkaDrawntype

Something a dressing drew: the element to put on the table, and what to do when the table takes it away again (stop a timer, say).

TenkaDressingtype

HOW A TABLE DRAWS ITS DICE AND ITS CARDS, if not the plain way: each is a function that is given what the rules decided and hands back the element to show.

TenkaLandtype

One territory as a drawing needs it.

TenkaLocaletype

The languages the package speaks: English and Japanese.

tenkaMapModelfunction

EVERYTHING A DRAWING OF THE WORLD NEEDS, for one game: each territory's outline in its owner's colour, its counter's place and armies, and its ring.

TenkaMapModeltype

The whole world as a drawing needs it, in map units: tenkaMapModel makes one, tenkaMapSvg and TenkaMap draw it.

tenkaMapSvgfunction

THE WORLD AS AN SVG ELEMENT, drawn from a model (tenkaMapModel): the sea, each territory in its owner's colour, the continents' borders and the sea links, the rings of a choice, and a counter of armies on each.

TenkaRingtype

How a territory is ringed: the one chosen, one it can reach, or the target.

tenkaSayfunction

A line from a table of strings with its braces filled in: tenkaSay(strings.moveIn, { n: 3 }) is "Move 3 in".

tenkaShapesOffunction

How a game's map is drawn: the world unless the game says otherwise.

tenkaStringsfunction

The table of strings for a locale with a page's own words laid over it.

TenkaStringstype

Every table word, including local embed error feedback.

TenkaTableHandletype

Native game access, restoration, redealing and presentation updates.

TenkaTableOptionstype

Native table settings; defaults to three players, with two computers.

TenkaViewtype

A part of the map to show, in map units: left, top, width, height (an SVG viewBox).

territoryNameInfunction

A territory's name in a table of strings, by its key (TENKA_TERRITORIES[n].key, such as "alaska"); "" for a key that is no territory's.

@johnmorrisdotca/tenka/react

TenkaMapfunction

THE WORLD, AS A REACT COMPONENT: every territory in its owner's colour, its counter of armies, the rings of a choice, and a press on a territory or its counter reported by number.

TenkaMapPropstype

What TenkaMap takes: a game to draw, and any attribute of its <svg>.

TenkaTablefunction

A whole table against the computer, as a React component: the plain-DOM table (mountTenka) mounted into this component's element once the browser has it.

TenkaTablePropstype

What TenkaTable takes: the options of mountTenka, and any attribute of its <div>.

@johnmorrisdotca/tenka/dressing

TENKA_BACKconstant

Tenka's own back, as the deck shows it.

TenkaBackHowtype

What a dressing is told about the back it is asked to draw.

tenkaCardDesignfunction

Tenka's cards as a Toranpu design: ask Toranpu for tenkaCardId(map, territory) in this design and it draws the territory's shape and name with its army's symbol, on its paper and in its frame.

TenkaCardHowtype

What a dressing is told about a card it is asked to draw.

tenkaCardIdfunction

The id of a card in Toranpu's hands: tenka-world-12 for the world's twelfth territory, tenka-wild for a wild card.

tenkaCardOfIdfunction

The map and territory an id of tenkaCardId names, or null for a wild card (wild: true) or anything else.

TenkaDieHowtype

What a dressing is told about a die it is asked to draw.

TenkaDrawntype

Something a dressing drew: the element to put on the table, and what to do when the table takes it away again (stop a timer, say).

tenkaDressingfunction

Tenka's dice and cards, drawn by the packages that draw them best: give the result to mountTenka, to the React TenkaTable, or to a <tenka-table>'s dressing.

TenkaDressingtype

HOW A TABLE DRAWS ITS DICE AND ITS CARDS, if not the plain way: each is a function that is given what the rules decided and hands back the element to show.

tenkaThrownDiefunction

A random source for Korokoro that comes up with face on a die of six: how a die is made to tumble onto the face the game has already thrown.

@johnmorrisdotca/tenka/element

defineTablefunction

Register a default or custom-tag table; server-safe and idempotent.

TenkaElementOptionstype

Full native host options, including names and custom card/dice drawings.

TenkaTableclass

A reflected native Tenka table, safe to import without a browser.

@johnmorrisdotca/tenka/element/define

defineTablefunction

Register a default or custom-tag table; server-safe and idempotent.

TenkaElementOptionstype

Full native host options, including names and custom card/dice drawings.

TenkaTableclass

A reflected native Tenka table, safe to import without a browser.

@johnmorrisdotca/tenka

areNeighboursfunction

Whether two territories are neighbours, by land or by sea.

armiesHeldfunction

How many armies an owner has on the map.

attacksOpenfunction

Every attack open now: from each territory of theirs with armies to spare, on each neighbour somebody else holds, with each number of dice — and the same attack again and again until it is decided.

battleLossesfunction

WHO LOSES WHAT: the highest die of each side compared, then the next highest, as many pairs as the side with fewer dice threw.

beginTurnfunction

A turn starting for seat: its armies worked out, nothing yet taken, nothing rolled.

boardOffunction

The map an argument names, and the world for anything that is not one: these functions are handed to an array's map and filter (deck.map(cardKind)), which pass an index where the map would go.

cardKindfunction

What a card shows: land, sea or air for a territory's card, in turn round the map; wild for a wild card.

cardTerritoryfunction

The territory a card shows, or null for a wild card.

choiceNowfunction

A choice made on an earlier map, read against this one: only what still stands, and a number of armies the move can take.

cleanTenkaNamefunction

A name as the table typed it, tidied: spaces run together, trimmed, cut to TENKA_NAME_MOST.

connectedOwnfunction

Every territory of the same owner reachable from this one through that owner's own territories, in order; never the territory itself.

continentNameInfunction

A continent's name in a table of strings, by its key ("northAmerica", "asia"…).

continentsHeldfunction

The continents a seat holds every territory of.

countedfunction

THE COUNT, when the last round is over: whoever holds the most territories wins; level on territories, whoever has more armies on the map; level on both, they share the win.

decodeTenkafunction

A kept game read back, or null for nothing kept, or for text that is not a game these rules can play out again: a browser's storage is somebody's to edit, and a half-understood game is worse than none.

defendDicefunction

The dice a defender holding armies throws: as many as allowed, since more never hurts the defence.

encodeTenkafunction

A game as text to keep: its table and its moves.

endOfTurnfunction

THE END OF A TURN: a card for a player who took a territory in it, then the next player still in.

finishedfunction

The game ended, with these seats winning.

isSetfunction

Whether three cards make a set: three of one kind, one of each kind, or any two with a wild card (a wild card stands for whatever the set needs).

isTenkaSeedfunction

Whether a number is a seed a game can be dealt from: a whole number from 0 to TENKA_SEED_MOST.

isTenkaTablefunction

Whether a game this long for this many players is one Tenka is offered for.

isTerritoryfunction

Whether a number is a territory of the map.

isWildfunction

Whether a card is one of the two wild cards.

marksForfunction

What the map lights up for a choice.

mostAttackDicefunction

The most dice an attacker may throw from a territory holding armies: one army always stays behind.

mustTradefunction

Whether the player to move must trade cards before anything else: five or more in hand while reinforcing.

nextRandomfunction

The next number from the random at state, in [0, 1), and the state after it.

nextSeatInfunction

The next player still in after seat, round the table; the neutral army never takes a turn.

NO_CHOICEconstant

Nothing chosen: where a turn, and a table, start.

playTenkafunction

The game after the player to move makes move, or null when they may not: a move for another phase, a territory not theirs, a neighbour that is not one, dice they have not the armies for, a set that is not a set.

randomBelowfunction

A whole number from 0 to below - 1, and the state after it.

readTenkaMovefunction

A kept move read back, or null for anything that is not one.

reinforcementForfunction

THE ARMIES A TURN BRINGS: one for every three territories held, never fewer than three, and each continent held whole adds its bonus.

replayTenkafunction

A game made again from its table and its moves, or null if any move could not have been made when it was.

sensibleTenkaMovefunction

The computer player's move: one the rules accept, chosen as a person might.

setsInfunction

Every set a hand holds, each as its three cards smallest first, in order.

shuffledfunction

A list in a random order (Fisher and Yates), and the state after it; the list given is left alone.

startTenkafunction

A NEW GAME, all of it drawn from seed: who goes first; the territories shuffled and dealt round the table one at a time from that player, each with one army on it (at a table of two, dealt three ways, the neutral army taking every third); the cards shuffled; and each player's starting armies (TENKA_STARTING_ARMIES) less the ones already on their territories — scattered at random when placing is auto, or left to be placed by hand, one at a time round the table.

tapTerritoryfunction

What tapping territory does now: a new choice, and the move to make at once, if the tap is one.

TENKA_CARD_KINDSconstant

The three kinds a territory's card shows, in turn round the map, and the wild card that is any of them.

TENKA_CONTINENTSconstant

The world's six continents, each with the territories in it.

TENKA_DECKconstant

Every card in the game: the territories' cards, then the wild cards.

TENKA_LENGTHSconstant

The lengths of game startTenka takes, in rounds: 10, 20 and 60.

TENKA_MAP_LISTconstant

The maps in the order a set-up offers them: the world first, the usual one.

TENKA_MAPSconstant

Every map a game may be played on, by key.

TENKA_MOVESconstant

The kinds of move, by name: what goes in a move's kind.

TENKA_MUST_TRADE_ATconstant

With this many cards in hand a player must trade before placing; after knocking somebody out, down to fewer than this.

TENKA_NEUTRALconstant

The owner of the territories nobody at a table of two holds: the neutral army, which never takes a turn.

TENKA_PHASESconstant

The phases of a turn, by name: compare game.phase with these rather than with text typed out.

TENKA_PLACINGconstant

How the starting armies are placed: scattered at random (auto), or by the players in turn (hand).

TENKA_SEED_MOSTconstant

The largest seed a game keeps: the random's state is one 32-bit number.

TENKA_STARTING_ARMIESconstant

THE ARMIES EACH PLAYER STARTS WITH, by how many are playing: the standard table.

TENKA_STRINGSconstant

The package's words in each language it speaks: TENKA_STRINGS.en, TENKA_STRINGS.ja.

TENKA_TERRITORIESconstant

The world's territories: the map a game is played on unless it says otherwise.

TENKA_TRADE_STEPconstant

How much more each set is worth than the last, once TENKA_TRADE_VALUES runs out: 20, 25, 30…

TENKA_TRADE_VALUESconstant

WHAT A SET OF CARDS IS WORTH, by how many sets anybody has traded in before it: 4, 6, 8, 10, 12, 15, and five more for every set after that — the escalating standard schedule.

TENKA_VERSIONconstant

The version of this package, as package.json has it.

TENKA_WILDconstant

The kind of a wild card, which stands for whatever a set needs.

TENKA_WORLD_ROUNDSconstant

The whole world: played to the last player standing, and counted after sixty rounds if nobody is.

tenkaAgainfunction

The same table again, from nothing, with a new seed: a new deal, a new first player, new dice.

TenkaCardtype

A territory's card (0–41) or a wild card (42, 43).

TenkaCardKindtype

What a card shows: one of three kinds, or a wild card that stands for any of them.

TenkaChoicetype

A choice made on the map and not yet a move: where from, where to, and how many armies (tapTerritory).

TenkaContinenttype

A continent: its name, the armies holding all of it is worth each turn, and its territories.

TenkaContinentKeytype

A continent of any map, by key: the world's continents and Europe's regions.

tenkaCountfunction

A count said in the singular when it is one and the plural otherwise: tenkaCount(strings.countCardsOne, strings.countCards, 1) is "1 card".

tenkaDailySeedfunction

Today's seed, the date as a number: 2026-10-01 is 20261001.

tenkaDayfunction

The day a moment falls on, in UTC, written YYYY-MM-DD.

tenkaDeckForfunction

Every card of a game on this map: a card for each territory, numbered as the territories are, then the wild cards.

tenkaExportedfunction

A game as the JSON export's object: its table, its moves, and where it stands.

TenkaExportedtype

A whole JSON export of one game: what tenkaToJSON writes and tenkaFromJSON reads.

tenkaFromJSONfunction

A game from JSON that tenkaToJSON wrote, or text that encodeTenka did.

TenkaLocaletype

The languages the package speaks: English and Japanese.

TenkaMaptype

A map as the rules read it: its territories, its continents and each territory's neighbours by land and by sea.

TenkaMapMarkstype

What the map lights up for a choice (marksFor): the territory chosen, what it can reach, and the target.

tenkaMapOffunction

The map a game is played on: the one it was started on, and the world for a game saved before there was a choice.

tenkaMovesfunction

Every move the player to move may make now, each one playTenka accepts.

TenkaOwnertype

Who holds a territory: a seat, or TENKA_NEUTRAL.

TenkaPlacingtype

Starting armies placed at random, or by hand in turn.

tenkaPlayerNamefunction

A seat's name as the table reads it: the one given, or "Player 3".

tenkaRecordfunction

THE RECORD OF A GAME, move by move, with the dice and everything else each move brought: made by playing the game again from its seed.

TenkaRecordEntrytype

One move of a game's record, with what came of it: what the text and the CSV are written from.

TenkaRolltype

One roll of the dice — or the last of a run of them (blitz) — what each side threw, highest first, and what each lost in all.

tenkaSayfunction

A line from a table of strings with its braces filled in: tenkaSay(strings.moveIn, { n: 3 }) is "Move 3 in".

TenkaSeattype

A player's place round the table: 0 for the first name given, up to 5.

TenkaShapestype

How the world is drawn, in map units (tenkaShapes.data.ts, written by scripts/map.mjs).

tenkaStringsfunction

The table of strings for a locale with a page's own words laid over it.

TenkaStringstype

Every table word, including local embed error feedback.

TenkaTerritoryDatatype

One territory as the map script writes it: neighbours by land and by sea are indices into the same list.

tenkaToCSVfunction

A game as CSV, a row to a move, for a spreadsheet: TENKA_CSV_COLUMNS.

tenkaToJSONfunction

A game as JSON, two spaces deep, with the format's number first.

tenkaToTextfunction

A game as plain text, a line to a move, for a chat or a log: who placed what where, every throw of the dice, every territory taken, and how it ended.

TenkaTradetype

The last set of cards traded in, for the table to see: by whom, for how many, and the territory that got two more.

territoryNameInfunction

A territory's name in a table of strings, by its key (TENKA_TERRITORIES[n].key, such as "alaska"); "" for a key that is no territory's.

throwDicefunction

count dice, highest first, and the state after them.

tradeValuefunction

What the next set traded in is worth, when trades sets have been traded before it: 4, 6, 8, 10, 12, 15, 20, 25…

writeTenkaMovefunction

A move as the short list it is kept as — and sent as, to the other devices at a table played on several.