import type { CardId } from "../card-games.types.ts"; import type { OhHellGame, OhHellMove, OhHellPlay } from "./oh-hell.types.ts"; /** * A COMPUTER AT THE OH HELL TABLE. Bidding, it counts the tricks its hand * should take — high trumps, long trumps, aces outside and, in a hand of a * few cards, kings — and bids the nearest it may. Playing, it tries to take * a trick while it has taken fewer than it bid, as cheaply as it can, and to * lose every trick once it has made its bid, throwing its most dangerous * cards while it can do so safely. * * It reads a view of the game (`ohHellView`): its own hand, the turned card, * the bids and the cards played — nothing of another hand. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import type { OhHellView } from "@johnmorrisdotca/toranpu/oh-hell"; * import { ohHellView } from "@johnmorrisdotca/toranpu/oh-hell"; * * const names = Array.from({ length: CARD_GAME_TABLES.ohHell.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * const game = newGame("ohHell", { players: names, seed: 42 })!; * const value: OhHellView = ohHellView(game); * console.log(value.hand.length); * ``` */ export type OhHellView = { seat: number; hand: readonly CardId[]; trump: string; bid: number | null; took: number; trick: readonly OhHellPlay[]; seats: number; playable: readonly CardId[]; }; /** The part of the game the seat to play can see, which is all its computer is given. * * @param game - The current native game; applying a move returns a new state. * @returns The part of the game the seat to play can see, which is all its computer is given. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { ohHellView } 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(ohHellView(game)); * ``` */ export declare function ohHellView(game: OhHellGame): OhHellView; /** The tricks a hand should take with these trumps, roughly. * * @param hand - The player’s held cards, or the hand number for a deal. * @param trump - The current trump suit. * @param seats - The seat count or seat state supplied by this API. * @returns The tricks a hand should take with these trumps, roughly. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { ohHellWorth } 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(ohHellWorth(game.hands[0]!, game.trump, game.players.length)); * ``` */ export declare function ohHellWorth(hand: readonly CardId[], trump: string, seats: number): number; /** The bid nearest what the hand is worth, among those allowed. * * @param worth - The estimated number of tricks this hand can win. * @param allowed - The legal bids available to this player. * @returns The bid nearest what the hand is worth, among those allowed. * * @example * ```ts * import { chooseOhHellBid } from "@johnmorrisdotca/toranpu/oh-hell"; * * console.log(chooseOhHellBid(1.4, [0, 1, 2, 3])); * ``` */ export declare function chooseOhHellBid(worth: number, allowed: readonly number[]): number; /** The move a computer in the seat to play makes: always one the rules allow. * * @param game - The current native game; applying a move returns a new state. * @returns The move a computer in the seat to play makes: always one the rules allow. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { ohHellComputer } 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(ohHellComputer(game)); * ``` */ export declare function ohHellComputer(game: OhHellGame): OhHellMove;