CRAZY_EIGHTS_RULES定数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Crazy Eights as one CardGameRules: everything a table asks of the game.
インポート
import { CRAZY_EIGHTS_RULES } from "@johnmorrisdotca/toranpu/crazy-eights";
定義
const CRAZY_EIGHTS_RULES: CardGameRules<CrazyEightsGame, CrazyEightsMove> = {
start: startCrazyEights,
moves: crazyEightsMoves,
play: playCrazyEights,
over: (game) => game.phase === "over",
winners: crazyEightsWinners,
encode: encodeCrazyEights,
decode: decodeCrazyEights,
toPlay: (game) => game.toPlay,
computer: crazyEightsComputer,
seats: (game) => ({ players: game.players, computers: game.computers }),
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
start | (size: number, players: readonly string[], _reserved?: unknown, seed?: number, computers?: readonly boolean[]) => CrazyEightsGame | null | A new game for these players (one name a seat) at this size, or null for
a table the game is not offered for. |
moves | (game: CrazyEightsGame) => readonly CrazyEightsMove[] | Every move the player to move may make now; none once the game is over. |
play | (game: CrazyEightsGame, move: CrazyEightsMove) => CrazyEightsGame | null | The game after that move, or null for a move that may not be made. |
over | (game: CrazyEightsGame) => boolean | |
winners | (game: CrazyEightsGame) => readonly number[] | On a game that is over, every seat that won: more than one for a partnership or a tie. |
encode | (game: CrazyEightsGame) => string | The game as text: its table, seed and moves, never a hand ( |
decode | (text: string | null) => CrazyEightsGame | null | Text read back into the game it records, or null for anything these rules cannot play out again. |
toPlay | (game: CrazyEightsGame) => number | null | The seat to move, or null once the game is over. |
computer | (game: CrazyEightsGame) => CrazyEightsMove | The move a computer in the seat to move makes: always one of |
seats | (game: CrazyEightsGame) => CardSeats | Who sits where, and which seats a computer plays. |
sensible (省略可) | ((game: CrazyEightsGame, random: () => number) => CrazyEightsMove) | undefined | For a game a player choosing uniformly at random would almost never
finish (Gin Rummy, where random play rarely knocks), a random move a
sensible player might make, for tests and simulations. Always one of
|
例
import { CRAZY_EIGHTS_RULES } from "@johnmorrisdotca/toranpu/crazy-eights";
console.log(Object.keys(CRAZY_EIGHTS_RULES));[
'start', 'moves',
'play', 'over',
'winners', 'encode',
'decode', 'toPlay',
'computer', 'seats'
]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。