CardGamePlaystype
Each card game's game and move, so its rules can be named with their own types.
Import it
import type { CardGamePlays } from "@johnmorrisdotca/toranpu";
Definition
type CardGamePlays = {
hearts: {
game: HeartsGame;
move: HeartsMove;
};
bigTwo: {
game: BigTwoGame;
move: ClimbMove;
};
president: {
game: PresidentGame;
move: PresidentMove;
};
goFish: {
game: GoFishGame;
move: GoFishMove;
};
crazyEights: {
game: CrazyEightsGame;
move: CrazyEightsMove;
};
spades: {
game: SpadesGame;
move: SpadesMove;
};
ginRummy: {
game: GinGame;
move: GinMove;
};
euchre: {
game: EuchreGame;
move: EuchreMove;
};
cribbage: {
game: CribbageGame;
move: CribbageMove;
};
ohHell: {
game: OhHellGame;
move: OhHellMove;
};
war: {
game: WarGame;
move: WarMove;
};
};
Members
| Name | Type | Description |
|---|---|---|
hearts | { game: HeartsGame; move: HeartsMove; } | |
bigTwo | { game: BigTwoGame; move: ClimbMove; } | |
president | { game: PresidentGame; move: PresidentMove; } | |
goFish | { game: GoFishGame; move: GoFishMove; } | |
crazyEights | { game: CrazyEightsGame; move: CrazyEightsMove; } | |
spades | { game: SpadesGame; move: SpadesMove; } | |
ginRummy | { game: GinGame; move: GinMove; } | |
euchre | { game: EuchreGame; move: EuchreMove; } | |
cribbage | { game: CribbageGame; move: CribbageMove; } | |
ohHell | { game: OhHellGame; move: OhHellMove; } | |
war | { game: WarGame; move: WarMove; } |
Examples
import type { CardGamePlays } from "@johnmorrisdotca/toranpu";
import { newGame } from "@johnmorrisdotca/toranpu";
const value: CardGamePlays["hearts"]["game"] = newGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 })!;
console.log(value.phase);passingWhat it prints (run when this page was built)