EuchreGametype
A GAME OF EUCHRE: its table and moves (what is kept, KeptCardGame), and
everything the moves make. Four seats in two partnerships across the table,
seats 0 and 2 against 1 and 3. size is the score that wins: 5 or 10.
Import it
import type { EuchreGame } from "@johnmorrisdotca/toranpu/euchre";
Definition
type EuchreGame = KeptCardGame<EuchreMove> & {
deal: number;
phase: EuchrePhase;
hands: CardId[][];
upcard: CardId;
trump: CardSuit | null;
maker: number | null;
passes: number;
trick: EuchrePlay[];
lastTrick: {
plays: EuchrePlay[];
winner: number;
} | null;
played: CardId[];
toPlay: number | null;
tricks: number[];
scores: [
number,
number
];
results: EuchreHandScore[];
};
Members
| Name | Type | Description |
|---|---|---|
size | number | |
players | readonly string[] | |
computers | readonly boolean[] | |
seed | number | |
moves | readonly EuchreMove[] | |
deal | number | Which hand this is, from 0: the deal moves one seat round each time. |
phase | EuchrePhase | |
hands | string[][] | |
upcard | string | The card turned up from the four left over. |
trump | CardSuit | null | Trumps, once made; null while the making goes round. |
maker | number | null | The seat that made trumps. |
passes | number | How many seats have passed in the making's current round. |
trick | EuchrePlay[] | |
lastTrick | { plays: EuchrePlay[]; winner: number; } | null | |
played | string[] | |
toPlay | number | null | |
tricks | number[] | Tricks each seat has taken this hand. |
scores | [number, number] | Each partnership's points: seats 0 and 2, then 1 and 3. |
results | EuchreHandScore[] | Each finished hand, one row a hand. |
Examples
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import type { EuchreGame } from "@johnmorrisdotca/toranpu/euchre";
const names = Array.from({ length: CARD_GAME_TABLES.euchre.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("euchre", { players: names, seed: 42 })!;
const value: EuchreGame = game;
console.log(value.phase);orderWhat it prints (run when this page was built)