Reference · Browser table and SVG
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. Shared by the plain-DOM table and the React map, so both draw the same world from the same few rules.
Import it
import { tenkaMapModel } from "@johnmorrisdotca/tenka/ui";
Definition
function tenkaMapModel(game: Pick<TenkaGame, "owners" | "armies" | "map">, marks?: TenkaMapMarks, colours?: readonly string[]): TenkaMapModel
Parameters
| Name | Type | Description |
|---|---|---|
game | Pick<TenkaGame, "map" | "owners" | "armies"> | The current native game state. |
marks (optional) | TenkaMapMarks | The chosen, reachable and target territory highlights. |
colours (optional) | readonly string[] | undefined | The seat colour palette. |
Returns
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. Shared by the plain-DOM table and the React map, so both draw the same world from the same few rules.
Examples
import { startTenka } from "@johnmorrisdotca/tenka";
import { tenkaMapModel } from "@johnmorrisdotca/tenka/ui";
const game = startTenka(10,["Seat 1","Seat 2"],42)!;
console.log(tenkaMapModel(game).lands.length);42What it prints (run when this page was built)