import type { CardId } from "../card-games.types.ts"; /** * WHAT A PLAY IS WORTH IN BIG TWO, and every play a hand could make. * * The ranks run 3 low to 2 high (3 4 5 6 7 8 9 10 J Q K A 2), and between * cards of one rank the suits run diamonds, clubs, hearts, spades — so the * three of diamonds is the lowest card in the pack and the two of spades the * highest. A play is a single, a pair, three of a kind, or a five-card hand: * a straight, a flush, a full house, four of a kind with any fifth card, or a * straight flush, ranked in that order. A straight is five ranks in a row * from 3-4-5-6-7 up to 10-J-Q-K-A; a two never sits in one. */ /** The kinds of play in Big Two, a single to a straight flush. * * @example * ```ts * import type { BigTwoKind } from "@johnmorrisdotca/toranpu/big-two"; * * const value: BigTwoKind = "pair"; * console.log(value); * ``` */ export type BigTwoKind = "single" | "pair" | "triple" | "straight" | "flush" | "fullHouse" | "fourKind" | "straightFlush"; /** A play's kind and how strong it is among plays of the same number of cards. * * @example * ```ts * import type { BigTwoValue } from "@johnmorrisdotca/toranpu/big-two"; * import { bigTwoValue } from "@johnmorrisdotca/toranpu/big-two"; * * const value: BigTwoValue = bigTwoValue(["3D"])!; * console.log(value.kind); * ``` */ export type BigTwoValue = { kind: BigTwoKind; size: number; strength: number; }; /** A rank's height, the three lowest (0) and the two highest (12). * * @param card - The physical card or card id to read, draw or play. * @returns A rank's height, the three lowest (0) and the two highest (12). * * @example * ```ts * import { bigTwoRank } from "@johnmorrisdotca/toranpu/big-two"; * * console.log(bigTwoRank("2D")); * ``` */ export declare function bigTwoRank(card: CardId): number; /** A card's height in the whole pack, 0 (three of diamonds) to 51 (two of spades). * * @param card - The physical card or card id to read, draw or play. * @returns A card's height in the whole pack, 0 (three of diamonds) to 51 (two of spades). * * @example * ```ts * import { bigTwoCard } from "@johnmorrisdotca/toranpu/big-two"; * * console.log(bigTwoCard("3D")); * ``` */ export declare function bigTwoCard(card: CardId): number; /** Cards in Big Two's order, lowest first: how a hand is held. * * @param cards - The cards in their current order. * @returns Cards in Big Two's order, lowest first: how a hand is held. * * @example * ```ts * import { sortBigTwo } from "@johnmorrisdotca/toranpu/big-two"; * * console.log(sortBigTwo(["2S", "3D", "AC"])); * ``` */ export declare function sortBigTwo(cards: readonly CardId[]): CardId[]; /** What these cards are worth played together, or null for cards that make no play. * * @param cards - The cards in their current order. * @returns What these cards are worth played together, or null for cards that make no play. * * @example * ```ts * import { bigTwoValue } from "@johnmorrisdotca/toranpu/big-two"; * * console.log(bigTwoValue(["3D", "3C"])); * ``` */ export declare function bigTwoValue(cards: readonly CardId[]): BigTwoValue | null; /** Whether a play beats the one on the table: the same number of cards, and stronger. * * @param play - The player’s move or cards for this step. * @param table - The shared table or laid cards. * @returns Whether a play beats the one on the table: the same number of cards, and stronger. * * @example * ```ts * import { bigTwoBeats, bigTwoValue } from "@johnmorrisdotca/toranpu/big-two"; * * console.log(bigTwoBeats(bigTwoValue(["4D"])!, bigTwoValue(["3D"])!)); * ``` */ export declare function bigTwoBeats(play: BigTwoValue, table: BigTwoValue): boolean; /** Every play this hand could make, each once, lowest cards first within a kind. * * @param hand - The player’s held cards, or the hand number for a deal. * @returns Every play this hand could make, each once, lowest cards first within a kind. * * @example * ```ts * import { bigTwoPlays } from "@johnmorrisdotca/toranpu/big-two"; * * console.log(bigTwoPlays(["3D", "3C", "4H"])); * ``` */ export declare function bigTwoPlays(hand: readonly CardId[]): CardId[][];