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 · Euchre

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

NameTypeDescription
sizenumber
playersreadonly string[]
computersreadonly boolean[]
seednumber
movesreadonly EuchreMove[]
dealnumber

Which hand this is, from 0: the deal moves one seat round each time.

phaseEuchrePhase
handsstring[][]
upcardstring

The card turned up from the four left over.

trumpCardSuit | null

Trumps, once made; null while the making goes round.

makernumber | null

The seat that made trumps.

passesnumber

How many seats have passed in the making's current round.

trickEuchrePlay[]
lastTrick{ plays: EuchrePlay[]; winner: number; } | null
playedstring[]
toPlaynumber | null
tricksnumber[]

Tricks each seat has taken this hand.

scores[number, number]

Each partnership's points: seats 0 and 2, then 1 and 3.

resultsEuchreHandScore[]

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);
order

What it prints (run when this page was built)

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