import type { GameState, MoveInput, OpeningChoice, Point, ReplayFacts } from "../types.ts"; /** * What can be done to a game's record rather than to its position: burning a * turn, lifting the last move back off, and reading a record forwards. * * Lifted out of `engine.ts`, which had reached the File Size Gate's limit and * been answered twice by trimming its comments — a file doing too many jobs * does not do fewer of them because it is described in fewer words. These are * a coherent one: none of them decides whether a move is legal, and nothing in * the engine calls any of them. The dependency runs one way, from here into * the engine, which is why this can import from it without a cycle. * */ /** Whether skipping is enabled and a legal corner stone can burn the turn. * * @param state - The current immutable game position. * @returns Whether skipping is enabled and the selected empty point is legal in the current phase. * @example * ```ts * import { canSkip, createGame } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(canSkip(state)); * ``` */ export declare function canSkip(state: GameState): boolean; /** * Where a skipped turn puts its stone: the open intersection furthest from the * action, picked from the corner chosen by `roll`. A skip is still a stone on * the board — it just spends the turn somewhere that should not matter. * * @param state - The current immutable game position. * @param roll - A random value in [0,1), supplied for reproducible choices. * @returns The chosen empty point, or null when no point is available. * @example * ```ts * import { createGame, skipTarget } from "@johnmorrisdotca/narabe"; * * console.log(skipTarget(createGame({allowSkip:true}), 0.5)); * ``` */ export declare function skipTarget(state: GameState, roll?: number): Point | null; /** Burns the turn on a corner stone. A no-op when skipping is not allowed. * * @param state - The current immutable game position. * @param roll - A random value in [0,1), supplied for reproducible choices. * @returns The resulting position; a refused or inapplicable action leaves the input position unchanged. * @example * ```ts * import { createGame, skipMove } from "@johnmorrisdotca/narabe"; * * console.log(skipMove(createGame({allowSkip:true}), 0.5).moves.length); * ``` */ export declare function skipMove(state: GameState, roll?: number): GameState; /** Whether undo is enabled and a recorded move can be removed. * * @param state - The current immutable game position. * @returns Whether undo is enabled and a recorded move can be removed. * @example * ```ts * import { canUndo, createGame } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(canUndo(state)); * ``` */ export declare function canUndo(state: GameState): boolean; /** * Removes the last move, putting back anything it captured, a piece where it * came from, and a twisted quadrant the way it was. Also reopens a finished * game. The opening is left as it stands: a colour choice is a decision, not * a stone, and is not undone by lifting one. * * @param state - The current immutable game position. * @returns The resulting position; a refused or inapplicable action leaves the input position unchanged. * @example * ```ts * import { createGame, undoMove } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(undoMove(state)); * ``` */ export declare function undoMove(state: GameState): GameState; /** The point of the latest stone or piece move; null when no point was played. * * @param state - The current immutable game position. * @returns The last played point, or null when no move with a board point exists. * @example * ```ts * import { createGame, lastMove } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(lastMove(state)); * ``` */ export declare function lastMove(state: GameState): Point | null; /** * Replays a record through the engine: every position it passed through, * including the ones a swap-opening decision produced. When the record runs * out of decisions while a choice is pending, the chooser is assumed to have * kept their colour, which is all a store without seat data can say. * * Stops at the first move that will not replay, since the record no longer * fits the rules from there. `facts` says what the moves cannot: a record * read without them is taken to have had no clock, and a forfeit on it stops * the replay like any other move the rules refuse. * * @param start - The initial game position used to replay the record. * @param moves - The move record in replay order. * @param choices - Recorded choices made during the opening protocol. * @param facts - Whether the original game ran a clock; needed to accept forfeits. * @returns The initial position followed by every successfully replayed position; replay stops at the first refused input. * @example * ```ts * import { createGame, replayMoves } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(replayMoves(state, [{row:7,col:7}]).length); * ``` */ export declare function replayMoves(start: GameState, moves: readonly MoveInput[], choices?: readonly OpeningChoice[], facts?: ReplayFacts): GameState[];