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

pegPointsfunction

What laying the last card of cards scores, the count now count: fifteen, thirty-one, pairs and runs.

Import it

import { pegPoints } from "@johnmorrisdotca/toranpu/cribbage";

Definition

function pegPoints(cards: readonly CardId[], count: number): { points: number; why: string[]; }

Parameters

NameTypeDescription
cardsreadonly string[]

The cards in their current order.

countnumber

The requested number of cards, sounds or layout positions.

Returns

{ points: number; why: string[]; }

What laying the last card of cards scores, the count now count: fifteen, thirty-one, pairs and runs.

Examples

import { pegPoints } from "@johnmorrisdotca/toranpu/cribbage";

console.log(pegPoints(["5H", "5D", "5C"], 15));
{ points: 8, why: [ 'fifteen', 'three alike' ] }

What it prints (run when this page was built)

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