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

layOfffunction

The defender's side of a knock: their own melds first, then every card left that fits one of the knocker's melds laid off onto it — a run grown one card at a time, so a six can follow the five just laid.

Import it

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

Definition

function layOff(defender: readonly CardId[], knockerMelds: readonly GinMeld[]): { layout: GinLayout; laidOff: CardId[]; melds: GinMeld[]; }

Parameters

NameTypeDescription
defenderreadonly string[]

The defending player’s hand or melds.

knockerMeldsreadonly GinMeld[]

The knocking player’s declared melds.

Returns

{ layout: GinLayout; laidOff: CardId[]; melds: GinMeld[]; }

The defender's side of a knock: their own melds first, then every card left that fits one of the knocker's melds laid off onto it — a run grown one card at a time, so a six can follow the five just laid.

Examples

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

console.log(layOff(["6H", "AS"], [["3H", "4H", "5H"]]));
{
  layout: { melds: [], deadwood: [ 'AS' ] },
  laidOff: [ '6H' ],
  melds: [ [ '3H', '4H', '5H', '6H' ] ]
}

What it prints (run when this page was built)

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