toCSV関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A game's moves as CSV for a spreadsheet: a header, then a row a move, with
its number from 1, the seat from 1 and its player, the kind of move
(play, bid, pass…), the cards it names as two-letter ids with spaces
between, the move itself as JSON, and the move in English. Lines end CRLF,
as RFC 4180 has it. It is for reading, and is not read back.
インポート
import { toCSV } from "@johnmorrisdotca/toranpu";
定義
function toCSV<K extends CardGameKind>(kind: K, game: GameOf<K>): string
引数
| 名前 | 型 | 説明 |
|---|---|---|
kind | K | The named card game or sound kind. |
game | GameOf<K> | The current native game; applying a move returns a new state. |
戻り値
string
A game's moves as CSV for a spreadsheet: a header, then a row a move, with its number from 1, the seat from 1 and its player, the kind of move (play, bid, pass…), the cards it names as two-letter ids with spaces between, the move itself as JSON, and the move in English. Lines end CRLF, as RFC 4180 has it. It is for reading, and is not read back.
例
import { newGame, toCSV } from "@johnmorrisdotca/toranpu";
const game = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(toCSV("hearts", game));move,seat,player,action,cards,detail,text出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。