import type { CardId } from "../card-games.types.ts"; import type { PresidentGame, PresidentMove } from "./president.types.ts"; /** A rank's height: the three lowest (0), 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), the two highest (12). * * @example * ```ts * import { presidentRank } from "@johnmorrisdotca/toranpu/president"; * * console.log(presidentRank("2D")); * ``` */ export declare function presidentRank(card: CardId): number; /** Cards in President's order, lowest first, suits in a fixed order only so a hand always sorts the same way. * * @param cards - The cards in their current order. * @returns Cards in President's order, lowest first, suits in a fixed order only so a hand always sorts the same way. * * @example * ```ts * import { sortPresident } from "@johnmorrisdotca/toranpu/president"; * * console.log(sortPresident(["2S", "3D", "AC"])); * ``` */ export declare function sortPresident(cards: readonly CardId[]): CardId[]; /** How many cards the President and the Beggar swap: two, or one when only three are at the table. * * @param seats - The seat count or seat state supplied by this API. * @returns How many cards the President and the Beggar swap: two, or one when only three are at the table. * * @example * ```ts * import { presidentSwapCount } from "@johnmorrisdotca/toranpu/president"; * * console.log(presidentSwapCount(4)); * ``` */ export declare function presidentSwapCount(seats: number): number; /** A new game of President for these players (one name a seat) at this size, dealt from the seed `dealt`, or null for a table President 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 President for these players (one name a seat) at this size, dealt from the seed `dealt`, or null for a table President 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 { startPresident } from "@johnmorrisdotca/toranpu/president"; * * const names = Array.from({ length: CARD_GAME_TABLES.president.defaultPlayers }, (_, seat) => `Seat ${seat + 1}`); * console.log(startPresident(CARD_GAME_TABLES.president.defaultSize, names, undefined, 42)?.phase); * ``` */ export declare function startPresident(size: number, players: readonly string[], _language?: unknown, dealt?: number, computers?: readonly boolean[]): PresidentGame | null; /** Whether these cards may be played now by the seat to play: one rank, one to four of it, higher than the table's and as many. * * @param game - The current native game; applying a move returns a new state. * @param cards - The cards in their current order. * @returns Whether these cards may be played now by the seat to play: one rank, one to four of it, higher than the table's and as many. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { presidentMayPlay } 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(presidentMayPlay(game, [game.hands[game.toPlay!]![0]!])); * ``` */ export declare function presidentMayPlay(game: PresidentGame, cards: readonly CardId[]): boolean; /** 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 { presidentMoves } 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(presidentMoves(game)); * ``` */ export declare function presidentMoves(game: PresidentGame): PresidentMove[]; /** 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 { playPresident } 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(playPresident(game, rulesFor("president").moves(game)[0]!)?.moves.length); * ``` */ export declare function playPresident(game: PresidentGame, move: PresidentMove): PresidentGame | null; /** The most points wins; level on the most shares it. * * @param game - The current native game; applying a move returns a new state. * @returns The most points wins; level on the most shares it. * * @example * ```ts * import { CARD_GAME_TABLES, newGame } from "@johnmorrisdotca/toranpu"; * import { presidentWinners } 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(presidentWinners(game)); * ``` */ export declare function presidentWinners(game: PresidentGame): number[]; /** Each seat's title from a round's finishing order: 0 President, 1 Vice-President, the last two Vice-Beggar and Beggar, everybody else a Citizen. * * @example * ```ts * import type { PresidentTitle } from "@johnmorrisdotca/toranpu/president"; * * const value: PresidentTitle = "president"; * console.log(value); * ``` */ export type PresidentTitle = "president" | "vicePresident" | "citizen" | "viceBeggar" | "beggar"; /** A seat's title from a round's finishing order. * * @param order - Seats in their finishing order, from first to last. * @param seat - The zero-based player seat. * @returns A seat's title from a round's finishing order. * * @example * ```ts * import { presidentTitle } from "@johnmorrisdotca/toranpu/president"; * * console.log(presidentTitle([0, 1, 2, 3], 0)); * ``` */ export declare function presidentTitle(order: readonly number[], seat: number): PresidentTitle;