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

sensibleTenkaMovefunction

The computer player's move: one the rules accept, chosen as a person might. random is any function returning a number from 0 up to 1, such as Math.random; give it a seeded one and the computer plays the same game every time.

Import it

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

Definition

function sensibleTenkaMove(game: TenkaGame, random: () => number): TenkaMove

Parameters

NameTypeDescription
gameTenkaGame

The current native game state.

random() => number

A random source returning values in [0,1).

Returns

TenkaMove

The computer player's move: one the rules accept, chosen as a person might. random is any function returning a number from 0 up to 1, such as Math.random; give it a seeded one and the computer plays the same game every time.

Examples

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

const game = startTenka(10,["Seat 1","Seat 2"],42)!;
console.log(sensibleTenkaMove(game,()=>0.5));
{ kind: 'place', territory: 32, armies: 4 }

What it prints (run when this page was built)

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