本文へ移動

Tenka天下

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

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

目次

リファレンス · ブラウザーの卓とSVG

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

インポート

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

定義

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

引数

名前型説明
fromnumber

The source territory index.

arrowTenkaArrow

The keyboard navigation direction.

map (省略可)TenkaMapKey

The native world or Europe map to use.

view (省略可)TenkaView | undefined

The visible map bounds; the full map when omitted.

戻り値

number | null

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

例

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

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

出力(このページを作ったときに実行した結果)

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

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