Reference · Rules, maps and records
TenkaGametype
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 it
import type { TenkaGame } from "@johnmorrisdotca/tenka";
Definition
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[];
};
Members
| Name | Type | Description |
|---|---|---|
map (optional) | 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. |
seed | number | The seed every shuffle, deal and die of this game is drawn from. |
players | readonly string[] | The names given at the table, in seat order: "" for one left blank. |
rounds | number | How many rounds before the count: |
placing | TenkaPlacing | |
moves | readonly TenkaMove[] | Every move made, in order: the game's whole record. |
rng | number | The random's state after everything drawn so far. |
first | number | The seat that plays first each round. |
round | number | The round being played, from 1. |
toPlay | number | |
phase | TenkaPhase | |
owners | readonly number[] | Per territory, who holds it. |
armies | readonly number[] | Per territory, how many armies stand there. |
hands | readonly (readonly number[])[] | Per seat, the cards in hand. |
deck | readonly number[] | The cards still to draw, top first. |
discards | readonly number[] | The cards traded in, shuffled back when the deck runs out. |
trades | number | How many sets have been traded in this game, by anybody: what the next set is worth. |
reserve | number | Armies waiting to be placed this turn. |
setUpLeft | readonly number[] | Per seat, starting armies still to place by hand. |
conquered | boolean | 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. |
lastRoll | TenkaRoll | null | The last roll of this turn, for the table to see. |
lastTrade | TenkaTrade | null | |
lastDraw | { seat: TenkaSeat; card: TenkaCard; } | null | The card drawn at the end of the last turn, and by whom. |
out | readonly boolean[] | Per seat, whether they are out: no territory left. |
lastOut | { seat: TenkaSeat; by: TenkaSeat; } | null | The last player knocked out, and by whom. |
winners | readonly number[] | On a finished game, every seat that won. Empty while playing. |
Examples
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: []
}What it prints (run when this page was built)