crazyMatchesfunction
Whether this card may go on the pile now: an eight always; otherwise the suit to follow or the top card's rank.
Import it
import { crazyMatches } from "@johnmorrisdotca/toranpu/crazy-eights";
Definition
function crazyMatches(game: CrazyEightsGame, card: CardId): boolean
Parameters
| Name | Type | Description |
|---|---|---|
game | CrazyEightsGame | The current native game; applying a move returns a new state. |
card | string | The physical card or card id to read, draw or play. |
Returns
boolean
Whether this card may go on the pile now: an eight always; otherwise the suit to follow or the top card's rank.
Examples
import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import { crazyMatches } from "@johnmorrisdotca/toranpu/crazy-eights";
const names = Array.from({ length: CARD_GAME_TABLES.crazyEights.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
let game = newGame("crazyEights", { players: names, seed: 42 })!;
console.log(crazyMatches(game, game.hands[game.toPlay!]![0]!));falseWhat it prints (run when this page was built)