GinMove型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A card drawn from the stock or taken from the discard pile, or a card thrown: laid on the pile, or face down to knock.
インポート
import type { GinMove } from "@johnmorrisdotca/toranpu/gin-rummy";
定義
type GinMove = {
draw: "stock";
} | {
draw: "discard";
} | {
discard: CardId;
} | {
knock: CardId;
};
例
import { CARD_GAME_TABLES, newGame, rulesFor } from "@johnmorrisdotca/toranpu";
import type { GinMove } from "@johnmorrisdotca/toranpu/gin-rummy";
const names = Array.from({ length: CARD_GAME_TABLES.ginRummy.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("ginRummy", { players: names, seed: 42 })!;
const value: GinMove = rulesFor("ginRummy").moves(game)[0]!;
console.log(value);{ draw: 'stock' }出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。