CribbageView型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A COMPUTER AT THE CRIBBAGE TABLE. Laying away, it tries every two cards it could throw and keeps the four whose show is worth most on average over every starter it might be cut, adding what the two thrown are worth to its own crib or taking it off the other player's. Pegging, it takes the most points a card can make now, and otherwise keeps the count off five and twenty-one (a ten makes fifteen or thirty-one of them), leads low, and never leads a five.
It reads a view of the game (cribbageView): its own hand and what is on
the table — nothing of the other hand, the crib, or the card to be cut.
インポート
import type { CribbageView } from "@johnmorrisdotca/toranpu/cribbage";
定義
type CribbageView = {
seat: number;
dealer: number;
phase: CribbageGame["phase"];
hand: readonly CardId[];
count: number;
run: readonly CardId[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
seat | number | |
dealer | number | |
phase | CribbagePhase | |
hand | readonly string[] | |
count | number | |
run | readonly string[] |
例
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { CribbageView } from "@johnmorrisdotca/toranpu/cribbage";
import { cribbageView } from "@johnmorrisdotca/toranpu/cribbage";
const names = Array.from({ length: CARD_GAME_TABLES.cribbage.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("cribbage", { players: names, seed: 42 })!;
const value: CribbageView = cribbageView(game);
console.log(value.hand.length);6出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。