本文へ移動

Tenka天下

2〜6人で、シードから始まる世界征服ゲームを遊べます。さいころでの戦い、カード、コンピューターの相手、ゲームの保存に対応します。

「天下」は、天の下に広がる世界を表す言葉です。 名前について(英語)

目次

リファレンス

ブラウザーの卓とSVG

import { … } from "@johnmorrisdotca/tenka/ui";

最小化と gzip 圧縮をしたサイズは 81.9 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Tenka drawn and played in the browser, in plain DOM: a whole table against the computer (mountTenka), and the map on its own (tenkaMapSvg, drawn from tenkaMapModel). Its own entry, so the rules never carry the map.

エクスポート

名前種類概要
continentNameIn関数A continent's name in a table of strings, by its key ("northAmerica", "asia"…).
continentView関数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.
landInDirection関数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.
mountTenka関数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).
nearestLand関数The territory whose counter is nearest a point of the map, within reach map units, or null.
NO_MARKS定数Nothing lit up.
ownerColour関数The colour a territory's owner is drawn in.
TENKA_MAP_SHAPES定数How each map is drawn.
TENKA_NEUTRAL_COLOUR定数The grey of the neutral army.
TENKA_SEAT_COLOURS定数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_STRINGS定数The package's words in each language it speaks: TENKA_STRINGS.en, TENKA_STRINGS.ja.
TENKA_STYLE定数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).
TenkaArrow型A way to move between territories from a keyboard.
TenkaBackHow型What a dressing is told about the back it is asked to draw.
TenkaCardHow型What a dressing is told about a card it is asked to draw.
TenkaDieHow型What a dressing is told about a die it is asked to draw.
TenkaDrawn型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).
TenkaDressing型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.
TenkaLand型One territory as a drawing needs it.
TenkaLocale型The languages the package speaks: English and Japanese.
tenkaMapModel関数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.
TenkaMapModel型The whole world as a drawing needs it, in map units: tenkaMapModel makes one, tenkaMapSvg and TenkaMap draw it.
tenkaMapSvg関数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.
TenkaRing型How a territory is ringed: the one chosen, one it can reach, or the target.
tenkaSay関数A line from a table of strings with its braces filled in: tenkaSay(strings.moveIn, { n: 3 }) is "Move 3 in".
tenkaShapesOf関数How a game's map is drawn: the world unless the game says otherwise.
tenkaStrings関数The table of strings for a locale with a page's own words laid over it.
TenkaStrings型Every table word, including local embed error feedback.
TenkaTableHandle型Native game access, restoration, redealing and presentation updates.
TenkaTableOptions型Native table settings; defaults to three players, with two computers.
TenkaView型A part of the map to show, in map units: left, top, width, height (an SVG viewBox).
territoryNameIn関数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.

ソースを見るGitHub で編集@johnmorrisdotca/tenka 2.2.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。