本文へ移動

Tenka天下

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

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

目次

リファレンス · ルール・地図・棋譜

TenkaGame型

リファレンスの説明と例は英語です。見出しと目次は日本語です。

A game, as its moves make it. Only the table — seed, players, rounds, placing — and moves are ever kept (encodeTenka); everything else is read again from them, dice and all, since every die is drawn from the game's own seeded random (rng). A kept game can never hold a world its moves do not make.

インポート

import type { TenkaGame } from "@johnmorrisdotca/tenka";

定義

type TenkaGame = {
    map?: TenkaMapKey;
    seed: number;
    players: readonly string[];
    rounds: number;
    placing: TenkaPlacing;
    moves: readonly TenkaMove[];
    rng: number;
    first: TenkaSeat;
    round: number;
    toPlay: TenkaSeat;
    phase: TenkaPhase;
    owners: readonly TenkaOwner[];
    armies: readonly number[];
    hands: readonly (readonly TenkaCard[])[];
    deck: readonly TenkaCard[];
    discards: readonly TenkaCard[];
    trades: number;
    reserve: number;
    setUpLeft: readonly number[];
    conquered: boolean;
    occupying: {
        from: number;
        to: number;
        least: number;
    } | null;
    shifting: {
        from: number;
        to: number;
    } | null;
    lastRoll: TenkaRoll | null;
    lastTrade: TenkaTrade | null;
    lastDraw: {
        seat: TenkaSeat;
        card: TenkaCard;
    } | null;
    out: readonly boolean[];
    lastOut: {
        seat: TenkaSeat;
        by: TenkaSeat;
    } | null;
    winners: readonly TenkaSeat[];
};

メンバー

名前型説明
map (省略可)TenkaMapKey | undefined

The map it is played on; left out for the world, so a game saved before there was a choice reads as it did.

seednumber

The seed every shuffle, deal and die of this game is drawn from.

playersreadonly string[]

The names given at the table, in seat order: "" for one left blank.

roundsnumber

How many rounds before the count: TENKA_WORLD_ROUNDS for the whole world.

placingTenkaPlacing
movesreadonly TenkaMove[]

Every move made, in order: the game's whole record.

rngnumber

The random's state after everything drawn so far.

firstnumber

The seat that plays first each round.

roundnumber

The round being played, from 1.

toPlaynumber
phaseTenkaPhase
ownersreadonly number[]

Per territory, who holds it.

armiesreadonly number[]

Per territory, how many armies stand there.

handsreadonly (readonly number[])[]

Per seat, the cards in hand.

deckreadonly number[]

The cards still to draw, top first.

discardsreadonly number[]

The cards traded in, shuffled back when the deck runs out.

tradesnumber

How many sets have been traded in this game, by anybody: what the next set is worth.

reservenumber

Armies waiting to be placed this turn.

setUpLeftreadonly number[]

Per seat, starting armies still to place by hand.

conqueredboolean

Whether the player to move has taken a territory this turn: a card at its end.

occupying{ from: number; to: number; least: number; } | null

The territory just taken, and the least that must move in.

shifting{ from: number; to: number; } | null

The two territories of the fortifying move chosen, waiting for how many.

lastRollTenkaRoll | null

The last roll of this turn, for the table to see.

lastTradeTenkaTrade | null
lastDraw{ seat: TenkaSeat; card: TenkaCard; } | null

The card drawn at the end of the last turn, and by whom.

outreadonly boolean[]

Per seat, whether they are out: no territory left.

lastOut{ seat: TenkaSeat; by: TenkaSeat; } | null

The last player knocked out, and by whom.

winnersreadonly number[]

On a finished game, every seat that won. Empty while playing.

例

import { startTenka } from "@johnmorrisdotca/tenka";
import type { TenkaGame } from "@johnmorrisdotca/tenka";

const game = startTenka(10,["Seat 1","Seat 2"],42)!;
const value: TenkaGame = game;
console.log(value);
{
  seed: 42,
  players: [ 'Seat 1', 'Seat 2' ],
  rounds: 10,
  placing: 'auto',
  moves: [],
  rng: 2192484137,
  first: 1,
  round: 1,
  toPlay: 1,
  phase: 'reinforce',
  owners: [
     1,  1,  1, 0, 1,  0, -1, -1, -1, -1,
     1, -1, -1, 1, 1,  0,  1,  0, -1,  0,
     0, -1, -1, 1, 0, -1,  1,  1,  0,  0,
     0,  1,  1, 0, 0,  0, -1,  1, -1,  0,
    -1, -1
  ],
  armies: [
    4, 2, 4, 1, 3, 1, 1, 4, 3, 2,
    4, 4, 2, 3, 2, 4, 1, 3, 4, 7,
    4, 2, 1, 4, 3, 6, 3, 2, 3, 4,
    3, 2, 5, 1, 1, 2, 1, 1, 4, 3,
    3, 3
  ],
  hands: [ [], [] ],
  deck: [
    39, 24,  6, 15, 43, 14, 17, 27, 33,  5,
    41, 19, 36, 38, 25, 32,  4, 16, 21,  1,
    18, 42, 11,  8,  0, 30,  3, 26, 12, 28,
    40, 29, 22, 34, 23,  2, 37, 10,  7, 20,
    35, 31, 13,  9
  ],
  discards: [],
  trades: 0,
  reserve: 4,
  setUpLeft: [ 0, 0 ],
  conquered: false,
  occupying: null,
  shifting: null,
  lastRoll: null,
  lastTrade: null,
  lastDraw: null,
  out: [ false, false ],
  lastOut: null,
  winners: []
}

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

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

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