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

spadesTrickWinnerfunction

Who takes a finished trick (or is winning one still being played): the highest spade, or else the highest card of the suit led.

Import it

import { spadesTrickWinner } from "@johnmorrisdotca/toranpu/spades";

Definition

function spadesTrickWinner(trick: readonly SpadesPlay[]): number

Parameters

NameTypeDescription
trickreadonly SpadesPlay[]

The cards and seats in the current trick.

Returns

number

Who takes a finished trick (or is winning one still being played): the highest spade, or else the highest card of the suit led.

Examples

import { spadesTrickWinner } from "@johnmorrisdotca/toranpu/spades";

console.log(spadesTrickWinner([{ seat: 0, card: "AC" }, { seat: 1, card: "2S" }, { seat: 2, card: "KC" }, { seat: 3, card: "QC" }]));
1

What it prints (run when this page was built)

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