startHeartsfunction
A new game of Hearts for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Hearts is not offered for. computers says, one a seat, which seats a computer plays; the third argument is unused.
Import it
import { startHearts } from "@johnmorrisdotca/toranpu/hearts";
Definition
function startHearts(size: number, players: readonly string[], _language?: unknown, dealt?: number, computers?: readonly boolean[]): HeartsGame | null
Parameters
| Name | Type | Description |
|---|---|---|
size | number | The game’s length or size, as defined by its table specification. |
players | readonly string[] | The player names in seat order. |
_language (optional) | unknown | An unused legacy language argument retained for compatibility. |
dealt (optional) | number | undefined | The numeric seed used to deal the game. |
computers (optional) | readonly boolean[] | undefined | Flags by seat: true where a computer controls that seat. |
Returns
HeartsGame | null
A new game of Hearts for these players (one name a seat) at this size, dealt from the seed dealt, or null for a table Hearts is not offered for. computers says, one a seat, which seats a computer plays; the third argument is unused.
Examples
import { CARD_GAME_TABLES } from "@johnmorrisdotca/toranpu";
import { startHearts } from "@johnmorrisdotca/toranpu/hearts";
const names = Array.from({ length: CARD_GAME_TABLES.hearts.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
console.log(startHearts(CARD_GAME_TABLES.hearts.defaultSize, names, undefined, 42)?.phase);passingWhat it prints (run when this page was built)