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

chooseCribfunction

The two cards to lay away: the four kept worth most on average with every starter, the crib counted for or against.

Import it

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

Definition

function chooseCrib(hand: readonly CardId[], ownCrib: boolean): [CardId, CardId]

Parameters

NameTypeDescription
handreadonly string[]

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

ownCribboolean

Whether the crib belongs to this player.

Returns

[string, string]

The two cards to lay away: the four kept worth most on average with every starter, the crib counted for or against.

Examples

import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu";
import { chooseCrib } from "@johnmorrisdotca/toranpu/cribbage";

const names = Array.from({ length: CARD_GAME_TABLES.cribbage.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`);
let game = newGame("cribbage", { players: names, seed: 42 })!;
console.log(chooseCrib(game.hands[0]!, true));
[ '2H', 'QS' ]

What it prints (run when this page was built)

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