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

CrazyEightsMovetype

A card played (an eight names the suit to follow), a card drawn from the stock, or a turn passed.

Import it

import type { CrazyEightsMove } from "@johnmorrisdotca/toranpu/crazy-eights";

Definition

type CrazyEightsMove = {
    play: CardId;
    suit?: CardSuit;
} | {
    draw: true;
} | {
    pass: true;
};

Examples

import { CARD_GAME_TABLES, newGame, rulesFor } from "@johnmorrisdotca/toranpu";
import type { CrazyEightsMove } from "@johnmorrisdotca/toranpu/crazy-eights";

const names = Array.from({ length: CARD_GAME_TABLES.crazyEights.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
const game = newGame("crazyEights", { players: names, seed: 42 })!;
const value: CrazyEightsMove = rulesFor("crazyEights").moves(game)[0]!;
console.log(value);
{ play: '3S' }

What it prints (run when this page was built)

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