import type { KlondikeMove, KlondikePile, KlondikeTable } from "./klondike.types.ts"; /** * WHAT A PERSON MEANT, read against the rules: 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 (a drag, two taps, a double tap, a key) * goes through the same few lines, and a test can drive them without a browser. */ /** 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 { TableSpot } from "@johnmorrisdotca/toranpu/klondike"; * * const value: TableSpot = { pile: "1", index: 0 }; * console.log(value.pile); * ``` */ export type TableSpot = { pile: KlondikePile; 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 { dealKlondike, dealOfSeed, deckOf, pileCards } from "@johnmorrisdotca/toranpu/klondike"; * * const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 }); * console.log(pileCards(table, "1")); * ``` */ export declare function pileCards(table: KlondikeTable, pile: KlondikePile): readonly number[]; /** * The cards a person can take hold of from a spot, the one held and every one * on it, or none: the waste's top card, a foundation's top card, or any * face-up card of a column with the run on top of it. * * @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: the waste's top card, a foundation's top card, or any face-up card of a column with the run on top of it. * * @example * ```ts * import { dealKlondike, dealOfSeed, deckOf, liftable } from "@johnmorrisdotca/toranpu/klondike"; * * const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 }); * console.log(liftable(table, { pile: "1", index: table.tableau[0]!.cards.length - 1 })); * ``` */ export declare function liftable(table: KlondikeTable, spot: TableSpot): readonly number[]; /** * The move that carries the cards held at `from` to `to`, if the rules allow * exactly those cards there. A column gives up the one run that fits, so the * card held must be that run's foot: holding the 7 of a 9-8-7 and letting it * go on an 8 carries the 7, never the 9 that happens to fit somewhere. * * @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 exactly the held cards cannot move to that destination. * * @example * ```ts * import { dealKlondike, dealOfSeed, deckOf, moveFor } from "@johnmorrisdotca/toranpu/klondike"; * * const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 }); * console.log(moveFor(table, { pile: "1", index: table.tableau[0]!.cards.length - 1 }, "2")); * ``` */ export declare function moveFor(table: KlondikeTable, from: TableSpot, to: KlondikePile): KlondikeMove | 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 move to a foundation, or null when the selected top card cannot go home. * * @example * ```ts * import { dealKlondike, dealOfSeed, deckOf, homeMove } from "@johnmorrisdotca/toranpu/klondike"; * * const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 }); * console.log(homeMove(table, { pile: "1", index: table.tableau[0]!.cards.length - 1 })); * ``` */ export declare function homeMove(table: KlondikeTable, spot: TableSpot): KlondikeMove | null; /** What a press on the stock does: turn it, or turn the waste back over, or nothing once the passes are spent. * * @param table - The native solitaire table; move helpers leave the input unchanged. * @returns The legal stock or recycle move, or null when no stock action is available. * * @example * ```ts * import { dealKlondike, dealOfSeed, deckOf, stockMove } from "@johnmorrisdotca/toranpu/klondike"; * * const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 }); * console.log(stockMove(table)); * ``` */ export declare function stockMove(table: KlondikeTable): KlondikeMove | null; /** * THE GAME PLAYS ITSELF OUT once every card on the columns is face up: the * moves that bring the rest home, found by the solver on a small budget (a * table with nothing hidden is solved in a handful of tables), or null while a * card is still face down or no way home is found — then the player goes on. * * @param table - The native solitaire table; move helpers leave the input unchanged. * @returns THE GAME PLAYS ITSELF OUT once every card on the columns is face up: the moves that bring the rest home, found by the solver on a small budget (a table with nothing hidden is solved in a handful of tables), or null while a card is still face down or no way home is found — then the player goes on. * * @example * ```ts * import { dealKlondike, dealOfSeed, deckOf, finishingMoves } from "@johnmorrisdotca/toranpu/klondike"; * * const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 }); * console.log(finishingMoves(table)); * ``` */ export declare function finishingMoves(table: KlondikeTable): KlondikeMove[] | null; /** * Whether nothing can be done but give up: no card can move anywhere, and the * stock can be neither turned nor turned back. With passes left a person may * still turn the stock for a card they need, so this is only ever said of the * one table where it is certainly true. * * @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, and the stock can be neither turned nor turned back. With passes left a person may still turn the stock for a card they need, so this is only ever said of the one table where it is certainly true. * * @example * ```ts * import { dealKlondike, dealOfSeed, deckOf, stuck } from "@johnmorrisdotca/toranpu/klondike"; * * const table = dealKlondike(deckOf(dealOfSeed(42))!, { draw: 3, passes: 3 }); * console.log(stuck(table)); * ``` */ export declare function stuck(table: KlondikeTable): boolean;