Reference · Rules, maps and records
tenkaToCSVfunction
A game as CSV, a row to a move, for a spreadsheet: TENKA_CSV_COLUMNS.
Territories are written by key (alaska, westernCanada), seats from 1,
dice as they fell, highest first and spaced. Lines end CRLF, as RFC 4180
has them, and a player's name that a spreadsheet would run as a formula is
made safe with a leading apostrophe.
Import it
import { tenkaToCSV } from "@johnmorrisdotca/tenka";
Definition
function tenkaToCSV(game: TenkaGame): string
Parameters
| Name | Type | Description |
|---|---|---|
game | TenkaGame | The current native game state. |
Returns
string
A game as CSV, a row to a move, for a spreadsheet: TENKA_CSV_COLUMNS. Territories are written by key (alaska, westernCanada), seats from 1, dice as they fell, highest first and spaced. Lines end CRLF, as RFC 4180 has them, and a player's name that a spreadsheet would run as a formula is made safe with a leading apostrophe.
Examples
import { startTenka, tenkaToCSV } from "@johnmorrisdotca/tenka";
const game = startTenka(10,["Seat 1","Seat 2"],42)!;
console.log(tenkaToCSV(game));move,round,seat,player,kind,from,to,armies,dice,attack,defend,attackerLost,defenderLost,throws,took,cards,out,winnersWhat it prints (run when this page was built)