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 · Rules, maps and records

tapTerritoryfunction

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

Import it

import { tapTerritory } from "@johnmorrisdotca/tenka";

Definition

function tapTerritory(game: TenkaGame, choice: TenkaChoice, territory: number): { choice: TenkaChoice; move: TenkaMove | null; }

Parameters

NameTypeDescription
gameTenkaGame

The current native game state.

choiceTenkaChoice

The current user-interface selection.

territorynumber

The native territory index.

Returns

{ choice: TenkaChoice; move: TenkaMove | null; }

The new selection and a move to apply; move is null when the tap only changes the selection.

Examples

import { startTenka, tapTerritory } from "@johnmorrisdotca/tenka";

const game = startTenka(10,["Seat 1","Seat 2"],42)!;
const choice = {from:null,to:null,armies:1,placedOn:null};
console.log(tapTerritory(game,choice,0));
{
  choice: { from: null, to: null, armies: 0, placedOn: 0 },
  move: { kind: 'place', territory: 0, armies: 1 }
}

What it prints (run when this page was built)

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