HitotsuGame型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A GAME OF HITOTSU: its table and moves (what is kept), and the hand they
have reached. size is the score that wins — 200 or 500 — or 1 for a game
of a single hand.
インポート
import type { HitotsuGame } from "@johnmorrisdotca/hitotsu";
定義
type HitotsuGame = {
size: number;
players: readonly string[];
computers: readonly boolean[];
seed: number;
options: HitotsuOptions;
moves: readonly HitotsuMove[];
hand: number;
phase: "playing" | "over";
hands: HitotsuCard[][];
stock: HitotsuCard[];
discard: HitotsuCard[];
colour: HitotsuColour;
direction: 1 | -1;
toPlay: number | null;
drawn: HitotsuCard | null;
pending: number;
pendingFace: "D" | "F" | null;
challenge: HitotsuChallenge | null;
passes: number;
turnovers: number;
scores: number[];
results: HitotsuResult[];
news: HitotsuNews[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
size | number | |
players | readonly string[] | |
computers | readonly boolean[] | |
seed | number | |
options | HitotsuOptions | |
moves | readonly HitotsuMove[] | |
hand | number | Which hand this is, from 0: it decides who plays first. |
phase | "playing" | "over" | |
hands | string[][] | |
stock | string[] | Face down, top card first. |
discard | string[] | Face up, top card last. |
colour | HitotsuColour | The colour to follow: the top card's, or the one a wild called. |
direction | 1 | -1 | 1 round the table to the left, -1 after a reverse. |
toPlay | number | null | |
drawn | string | null | The card the player to move has just drawn, the only one they may now play; null before they draw. |
pending | number | Cards the player to move must take unless they stack a draw card on them. |
pendingFace | "D" | "F" | null | The last draw card stacked, for "same card" stacking: |
challenge | HitotsuChallenge | null | |
passes | number | Turns passed in a row with nothing to play or draw: when every player has, the hand is blocked. |
turnovers | number | How many times the discards have been shuffled into a new stock this hand. |
scores | number[] | |
results | HitotsuResult[] | |
news | HitotsuNews[] | What the last move did, beyond the card itself. |
例
import type { HitotsuGame } from "@johnmorrisdotca/hitotsu";
import { startHitotsu } from "@johnmorrisdotca/hitotsu";
const value: HitotsuGame = startHitotsu(1, ["Aki", "Ben"], 42)!;
console.log(value.hands.map((hand) => hand.length));[ 7, 7 ]出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。