import type { CardId } from "../card-games.types.ts"; import type { ClimbPlay } from "../climbing/climbing.types.ts"; import type { PresidentGame, PresidentMove } from "./president.types.ts"; /** * A COMPUTER AT THE PRESIDENT TABLE, playing as a sensible player does: hand * back its lowest cards, lead its lowest rank whole, beat the table with the * lowest rank that matches the count exactly rather than breaking up a pair * or a triple, and keep its twos and aces back until the table is nearly * empty or it is. * * It reads a view of the game (`presidentView`): its own hand, what is on the * table, how many cards each player holds, and nothing else. */ /** What one seat can see of a game of President: its own hand, the table, and what has been said and shown. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import type { PresidentView } from "@johnmorrisdotca/toranpu/president"; * import { presidentView } from "@johnmorrisdotca/toranpu/president"; * * const names = Array.from({ length: CARD_GAME_TABLES.president.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * const game = newGame("president", { players: names, seed: 42 })!; * const value: PresidentView = presidentView(game); * console.log(value.hand.length); * ``` */ export type PresidentView = { seat: number; hand: readonly CardId[]; pile: ClimbPlay | null; counts: readonly number[]; legal: readonly PresidentMove[]; }; /** 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 { presidentView } from "@johnmorrisdotca/toranpu/president"; * * const names = Array.from({ length: CARD_GAME_TABLES.president.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("president", { players: names, seed: 42 })!; * console.log(presidentView(game)); * ``` */ export declare function presidentView(game: PresidentGame): PresidentView; /** 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 { presidentComputer } from "@johnmorrisdotca/toranpu/president"; * * const names = Array.from({ length: CARD_GAME_TABLES.president.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * let game = newGame("president", { players: names, seed: 42 })!; * console.log(presidentComputer(game)); * ``` */ export declare function presidentComputer(game: PresidentGame): PresidentMove;