import type { CardId, CardSuit } from "../card-games.types.ts"; import type { EuchreGame, EuchreMove, EuchrePlay } from "./euchre.types.ts"; /** * A COMPUTER AT THE EUCHRE TABLE. Making trumps, it weighs its hand in each * suit — the bowers, the trump ace and king, the aces outside and the suits * it is short in — and orders up or names a suit only with a hand that should * take three tricks with its partner's help, counting the turned card for its * own side when it or its partner deals. Stuck as dealer, it names its best. * Playing, it leads its best trump when its side made them, cashes aces, * leaves a trick its partner has won alone, and takes a trick as cheaply as * it can. * * It reads a view of the game (`euchreView`): its own hand, the card turned * up, the making so far and the cards played — nothing of another hand. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import type { EuchreView } from "@johnmorrisdotca/toranpu/euchre"; * import { euchreView } from "@johnmorrisdotca/toranpu/euchre"; * * const names = Array.from({ length: CARD_GAME_TABLES.euchre.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * const game = newGame("euchre", { players: names, seed: 42 })!; * const value: EuchreView = euchreView(game); * console.log(value.hand.length); * ``` */ export type EuchreView = { seat: number; dealer: number; hand: readonly CardId[]; phase: EuchreGame["phase"]; upcard: CardId; trump: CardSuit | null; maker: number | null; trick: readonly EuchrePlay[]; tricks: readonly number[]; seen: ReadonlySet; 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 { euchreView } from "@johnmorrisdotca/toranpu/euchre"; * * const names = Array.from({ length: CARD_GAME_TABLES.euchre.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("euchre", { players: names, seed: 42 })!; * console.log(euchreView(game)); * ``` */ export declare function euchreView(game: EuchreGame): EuchreView; /** How much a hand is worth with this suit as trumps, roughly in tricks. * * @param hand - The player’s held cards, or the hand number for a deal. * @param trump - The current trump suit. * @returns How much a hand is worth with this suit as trumps, roughly in tricks. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { trumpWorth } from "@johnmorrisdotca/toranpu/euchre"; * * const names = Array.from({ length: CARD_GAME_TABLES.euchre.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("euchre", { players: names, seed: 42 })!; * console.log(trumpWorth(game.hands[0]!, "H")); * ``` */ export declare function trumpWorth(hand: readonly CardId[], trump: CardSuit): 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 { euchreComputer } from "@johnmorrisdotca/toranpu/euchre"; * * const names = Array.from({ length: CARD_GAME_TABLES.euchre.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("euchre", { players: names, seed: 42 })!; * console.log(euchreComputer(game)); * ``` */ export declare function euchreComputer(game: EuchreGame): EuchreMove; /** After picking the turned card up: the lowest card outside trumps, from the shortest suit, never an ace. * * @param hand - The player’s held cards, or the hand number for a deal. * @param trump - The current trump suit. * @returns After picking the turned card up: the lowest card outside trumps, from the shortest suit, never an ace. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { throwAway } from "@johnmorrisdotca/toranpu/euchre"; * * const names = Array.from({ length: CARD_GAME_TABLES.euchre.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("euchre", { players: names, seed: 42 })!; * console.log(throwAway(game.hands[0]!, "H")); * ``` */ export declare function throwAway(hand: readonly CardId[], trump: CardSuit): CardId;