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
| Name | Type | Description |
|---|---|---|
hand | readonly string[] | The player’s held cards, or the hand number for a deal. |
ownCrib | boolean | 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)