import type { CardId } from "../card-games.types.ts"; import type { OhHellGame, OhHellMove, OhHellPlay } from "./oh-hell.types.ts"; /** * OH HELL: the rules, and nothing else. * * Three or four players, each for themselves. The first deal is one card * each, the next two, and so up to seven (and, in the long game, back down to * one); after each deal the next card is turned up, and its suit is trumps. * From the dealer's left, each player bids exactly how many tricks they will * take. The dealer bids last and may not bid the number that would make the * bids add up to the tricks there are, so somebody must miss. Follow suit if * you can; the highest trump, or else the highest card of the suit led, takes * the trick. Take exactly what you bid and score ten and your bid; take any * other number and score nothing. The highest score after the last deal * wins. * * Pure: every function returns a new game and leaves the one given alone. */ /** The most cards dealt to a hand of Oh Hell: seven. * * @example * ```ts * import { OH_HELL_MOST_CARDS } from "@johnmorrisdotca/toranpu/oh-hell"; * console.log(OH_HELL_MOST_CARDS); * ``` */ export declare const OH_HELL_MOST_CARDS = 7; /** A card's height in a trick: ace high. * * @param card - The physical card or card id to read, draw or play. * @returns A card's height in a trick: ace high. * * @example * ```ts * import { ohHellHeight } from "@johnmorrisdotca/toranpu/oh-hell"; * * console.log(ohHellHeight("AS")); * ``` */ export declare function ohHellHeight(card: CardId): number; /** The cards dealt to each seat in each deal of a game of this length: up to seven, and back down in the long game. * * @param size - The game’s length or size, as defined by its table specification. * @returns The cards dealt to each seat in each deal of a game of this length: up to seven, and back down in the long game. * * @example * ```ts * import { dealSizes } from "@johnmorrisdotca/toranpu/oh-hell"; * import { CARD_GAME_TABLES } from "@johnmorrisdotca/toranpu"; * * console.log(dealSizes(CARD_GAME_TABLES.ohHell.defaultSize)); * ``` */ export declare function dealSizes(size: number): number[]; /** The seat that deals this deal: the first seat, then round to the left. * * @param deal - The deal number or dealing specification. * @param seats - The seat count or seat state supplied by this API. * @returns The seat that deals this deal: the first seat, then round to the left. * * @example * ```ts * import { dealerOf } from "@johnmorrisdotca/toranpu/oh-hell"; * * console.log(dealerOf(0, 4)); * ``` */ export declare function dealerOf(deal: number, seats: number): number; /** A hand as a player holds it: by suit, trumps last, high cards to the right. * * @param hand - The player’s held cards, or the hand number for a deal. * @param trump - The current trump suit. * @returns A hand as a player holds it: by suit, trumps last, high cards to the right. * * @example * ```ts * import { sortOhHell } from "@johnmorrisdotca/toranpu/oh-hell"; * * console.log(sortOhHell(["AS", "KH", "2C"], "S")); * ``` */ export declare function sortOhHell(hand: readonly CardId[], trump: string): CardId[]; /** A new game of Oh Hell for these players (one name a seat) at this size, dealt from the seed `dealt`, or null for a table Oh Hell is not offered for. `computers` says, one a seat, which seats a computer plays; the third argument is unused. * * @param size - The game’s length or size, as defined by its table specification. * @param players - The player names in seat order. * @param _language - An unused legacy language argument retained for compatibility. * @param dealt - The numeric seed used to deal the game. * @param computers - Flags by seat: true where a computer controls that seat. * @returns A new game of Oh Hell for these players (one name a seat) at this size, dealt from the seed `dealt`, or null for a table Oh Hell is not offered for. `computers` says, one a seat, which seats a computer plays; the third argument is unused. * * @example * ```ts * import { CARD_GAME_TABLES } from "@johnmorrisdotca/toranpu"; * import { startOhHell } from "@johnmorrisdotca/toranpu/oh-hell"; * * const names = Array.from({ length: CARD_GAME_TABLES.ohHell.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * console.log(startOhHell(CARD_GAME_TABLES.ohHell.defaultSize, names, undefined, 42)?.phase); * ``` */ export declare function startOhHell(size: number, players: readonly string[], _language?: unknown, dealt?: number, computers?: readonly boolean[]): OhHellGame | null; /** The bids open to the seat to bid: nought to the cards in hand, less the one a dealer may not make. * * @param game - The current native game; applying a move returns a new state. * @returns The bids open to the seat to bid: nought to the cards in hand, less the one a dealer may not make. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { ohHellBids } from "@johnmorrisdotca/toranpu/oh-hell"; * * const names = Array.from({ length: CARD_GAME_TABLES.ohHell.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("ohHell", { players: names, seed: 42 })!; * console.log(ohHellBids(game)); * ``` */ export declare function ohHellBids(game: OhHellGame): number[]; /** The cards the seat to play may lay: the suit led if it holds any. * * @param game - The current native game; applying a move returns a new state. * @returns The cards the seat to play may lay: the suit led if it holds any. * * @example * ```ts * import { CARD_GAME_TABLES, newGame, rulesFor } from "@johnmorrisdotca/toranpu"; * import { ohHellPlayable } from "@johnmorrisdotca/toranpu/oh-hell"; * * const names = Array.from({ length: CARD_GAME_TABLES.ohHell.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("ohHell", { players: names, seed: 42 })!; * const rules = rulesFor("ohHell"); * for (let setup = 0; setup < 100 && game.phase !== "playing" && game.phase !== "over"; setup += 1) { * const next = rules.play(game, rules.computer(game)); * if (next === null) throw new Error("Unexpected illegal setup move"); * game = next; * } * if (game.phase !== "playing") throw new Error("Setup did not reach playing"); * console.log(ohHellPlayable(game)); * ``` */ export declare function ohHellPlayable(game: OhHellGame): CardId[]; /** Who takes a trick: the highest trump, or else the highest card of the suit led. * * @param trick - The cards and seats in the current trick. * @param trump - The current trump suit. * @returns Who takes a trick: the highest trump, or else the highest card of the suit led. * * @example * ```ts * import { ohHellTrickWinner } from "@johnmorrisdotca/toranpu/oh-hell"; * * console.log(ohHellTrickWinner([{ seat: 0, card: "AH" }, { seat: 1, card: "KS" }, { seat: 2, card: "TH" }, { seat: 3, card: "QC" }], "S")); * ``` */ export declare function ohHellTrickWinner(trick: readonly OhHellPlay[], trump: string): number; /** Every move the seat to play may make now; none once the game is over. * * @param game - The current native game; applying a move returns a new state. * @returns Every move the seat to play may make now; none once the game is over. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { ohHellMoves } from "@johnmorrisdotca/toranpu/oh-hell"; * * const names = Array.from({ length: CARD_GAME_TABLES.ohHell.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("ohHell", { players: names, seed: 42 })!; * console.log(ohHellMoves(game)); * ``` */ export declare function ohHellMoves(game: OhHellGame): OhHellMove[]; /** What a seat scores for a deal: ten and its bid for exactly what it bid, nothing otherwise. * * @param bid - The bid being checked or scored. * @param tricks - The number of tricks won. * @returns What a seat scores for a deal: ten and its bid for exactly what it bid, nothing otherwise. * * @example * ```ts * import { dealPoints } from "@johnmorrisdotca/toranpu/oh-hell"; * * console.log(dealPoints(2, 2)); * ``` */ export declare function dealPoints(bid: number, tricks: number): number; /** The game after that move, with the move added to its record, or null for a move the rules refuse. * * @param game - The current native game; applying a move returns a new state. * @param move - The native move to validate or apply. * @returns The game after that move, with the move added to its record, or null for a move the rules refuse. * * @example * ```ts * import { CARD_GAME_TABLES, newGame, rulesFor } from "@johnmorrisdotca/toranpu"; * import { playOhHell } from "@johnmorrisdotca/toranpu/oh-hell"; * * const names = Array.from({ length: CARD_GAME_TABLES.ohHell.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("ohHell", { players: names, seed: 42 })!; * console.log(playOhHell(game, rulesFor("ohHell").moves(game)[0]!)?.moves.length); * ``` */ export declare function playOhHell(game: OhHellGame, move: OhHellMove): OhHellGame | null; /** The highest score after the last deal: every seat that has it. * * @param game - The current native game; applying a move returns a new state. * @returns The highest score after the last deal: every seat that has it. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { ohHellWinners } from "@johnmorrisdotca/toranpu/oh-hell"; * * const names = Array.from({ length: CARD_GAME_TABLES.ohHell.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("ohHell", { players: names, seed: 42 })!; * console.log(ohHellWinners(game)); * ``` */ export declare function ohHellWinners(game: OhHellGame): number[];