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

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. Null when nothing lies that way.

Import it

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

Definition

function landInDirection(from: number, arrow: TenkaArrow, map?: TenkaMapKey, view?: TenkaView): number | null

Parameters

NameTypeDescription
fromnumber

The source territory index.

arrowTenkaArrow

The keyboard navigation direction.

map (optional)TenkaMapKey

The native world or Europe map to use.

view (optional)TenkaView | undefined

The visible map bounds; the full map when omitted.

Returns

number | null

The nearest territory in the direction and view, or null when none is available.

Examples

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

console.log(landInDirection(0,"right"));
1

What it prints (run when this page was built)

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