Skip to the content

Toranpuトランプ

Use a deck, play eleven games with computers, solve a solitaire, or display cards in your own design.

Toranpu is Japanese for playing cards. About the name

Contents

Reference · Crazy Eights

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

NameTypeDescription
gameCrazyEightsGame

The current native game; applying a move returns a new state.

cardstring

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]!));
false

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/toranpu 2.15.0.