import type { FreeCellMove, FreeCellPile, FreeCellTable } from "./freecell.types.ts"; /** * WHAT A PERSON MEANT, read against FreeCell's rules, as Solitaire's * `intent.ts` reads Klondike's: the card they took hold of or tapped, and * where they let it go or tapped next, as a move — or nothing. Pure, so every * way of moving a card goes through the same few lines. */ /** A card on the table, as a person points at it: the pile, and its place from the bottom (-1 for the pile's empty place). * * @example * ```ts * import type { FreeCellSpot } from "@johnmorrisdotca/toranpu/freecell"; * * const value: FreeCellSpot = { pile: "1", index: 0 }; * console.log(value.pile); * ``` */ export type FreeCellSpot = { pile: FreeCellPile; index: number; }; /** The cards of a pile, bottom first, as the table holds them. * * @param table - The native solitaire table; move helpers leave the input unchanged. * @param pile - The pile to inspect or arrange. * @returns The cards of a pile, bottom first, as the table holds them. * * @example * ```ts * import { dealFreeCell, dealOfSeed, deckOf, freeCellPileCards } from "@johnmorrisdotca/toranpu/freecell"; * * const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4); * console.log(freeCellPileCards(table, "1")); * ``` */ export declare function freeCellPileCards(table: FreeCellTable, pile: FreeCellPile): readonly number[]; /** * The cards a person can take hold of from a spot, the one held and every one * on it, or none: a free cell's card, or a column's card with the run in order * on top of it. A foundation's cards stay home. * * @param table - The native solitaire table; move helpers leave the input unchanged. * @param spot - The source or destination card location. * @returns The cards a person can take hold of from a spot, the one held and every one on it, or none: a free cell's card, or a column's card with the run in order on top of it. A foundation's cards stay home. * * @example * ```ts * import { dealFreeCell, dealOfSeed, deckOf, freeCellLiftable } from "@johnmorrisdotca/toranpu/freecell"; * * const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4); * console.log(freeCellLiftable(table, { pile: "1", index: table.tableau[0]!.length - 1 })); * ``` */ export declare function freeCellLiftable(table: FreeCellTable, spot: FreeCellSpot): readonly number[]; /** The move that carries the cards held at `from` to `to`, if the rules allow exactly those cards there. * * @param table - The native solitaire table; move helpers leave the input unchanged. * @param from - The source position or source state specified by this API. * @param to - The destination position or state specified by this API. * @returns The matching legal carry, or null when the selected cards cannot move there. * * @example * ```ts * import { dealFreeCell, dealOfSeed, deckOf, freeCellMoveFor } from "@johnmorrisdotca/toranpu/freecell"; * * const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4); * console.log(freeCellMoveFor(table, { pile: "1", index: table.tableau[0]!.length - 1 }, "a")); * ``` */ export declare function freeCellMoveFor(table: FreeCellTable, from: FreeCellSpot, to: FreeCellPile): FreeCellMove | null; /** The move that sends a top card home, if it can go: what a double tap does. * * @param table - The native solitaire table; move helpers leave the input unchanged. * @param spot - The source or destination card location. * @returns The legal foundation move, or null when the selected card cannot go home. * * @example * ```ts * import { dealFreeCell, dealOfSeed, deckOf, freeCellHomeMove } from "@johnmorrisdotca/toranpu/freecell"; * * const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4); * console.log(freeCellHomeMove(table, { pile: "1", index: table.tableau[0]!.length - 1 })); * ``` */ export declare function freeCellHomeMove(table: FreeCellTable, spot: FreeCellSpot): FreeCellMove | null; /** * THE GAME PLAYS ITSELF OUT once nothing is left to decide: when every card * still out can go home in turn, the lowest first, the moves that take them * there — or null while one cannot, and the player goes on. * * @param table - The native solitaire table; move helpers leave the input unchanged. * @returns THE GAME PLAYS ITSELF OUT once nothing is left to decide: when every card still out can go home in turn, the lowest first, the moves that take them there — or null while one cannot, and the player goes on. * * @example * ```ts * import { dealFreeCell, dealOfSeed, deckOf, freeCellFinishingMoves } from "@johnmorrisdotca/toranpu/freecell"; * * const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4); * console.log(freeCellFinishingMoves(table)); * ``` */ export declare function freeCellFinishingMoves(table: FreeCellTable): FreeCellMove[] | null; /** Whether nothing can be done but give up: no card can move anywhere. * * @param table - The native solitaire table; move helpers leave the input unchanged. * @returns Whether nothing can be done but give up: no card can move anywhere. * * @example * ```ts * import { dealFreeCell, dealOfSeed, deckOf, freeCellStuck } from "@johnmorrisdotca/toranpu/freecell"; * * const table = dealFreeCell(deckOf(dealOfSeed(42))!, 4); * console.log(freeCellStuck(table)); * ``` */ export declare function freeCellStuck(table: FreeCellTable): boolean;