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 · Gin Rummy

canKnockWithfunction

Whether throwing this card, from a hand of eleven, leaves little enough deadwood to knock with.

Import it

import { canKnockWith } from "@johnmorrisdotca/toranpu/gin-rummy";

Definition

function canKnockWith(hand: readonly CardId[], card: CardId): boolean

Parameters

NameTypeDescription
handreadonly string[]

The player’s held cards, or the hand number for a deal.

cardstring

The physical card or card id to read, draw or play.

Returns

boolean

Whether throwing this card, from a hand of eleven, leaves little enough deadwood to knock with.

Examples

import { canKnockWith } from "@johnmorrisdotca/toranpu/gin-rummy";

console.log(canKnockWith(["3H", "4H", "5H", "7S", "8S", "9S", "8C", "8D", "8H", "AS", "KD"], "KD"));
true

What it prints (run when this page was built)

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