import type { GameState } from "../types.ts"; /** * Changing the board size mid-game, in either direction. * * A game that has run out of room is not necessarily a game that has run out * of ideas, so a bigger board gives both players somewhere to go. The stones * keep their positions relative to each other — the old board is re-centred on * the new one — because anything else would rewrite the game that had been * played rather than continue it. * * Growing does not pass the turn, and that is a correctness requirement rather * than a kindness. A growth places no stone, so nothing records that it * happened; if it changed whose turn it was, replaying the move list would * alternate colours differently from the game that was actually played, and a * stored game would no longer reproduce itself. It is also the better rule: * a bigger board helps both players, so charging the grower a tempo would * make growing strictly bad for whoever asked. * * For the same reason growth is only offered on an open board. Obstacles are * derived from the board size, so a grown game would start its replay with the * larger size's star points — which are not the ones it was played with. */ /** * The next size up, or null when the board is already the largest. A game * played on boards of its own — the flipping games, on 4, 6 and 8 — grows * through its own list rather than the go sizes. * * @param size - The number of cells on each side of the board. * @param sizes - The supported side lengths in ascending order. * @returns The next supported size, or null at the largest size. * @example * ```ts * import { nextBoardSize } from "@johnmorrisdotca/narabe"; * * console.log(nextBoardSize(9,[9,13,19])); * ``` */ export declare function nextBoardSize(size: number, sizes?: readonly number[]): number | null; /** * How far the old board shifts when centred on the new one. * * Both sizes are odd, or both even, so the difference is even and the offset * is exact: the centre stays the centre, and no stone is nudged off it. */ export declare function growthOffset(from: number, to: number): number; /** Whether resizing is enabled and a larger native board is available. * * @param state - The current immutable game position. * @returns Whether resizing is enabled and a larger native board is available. * @example * ```ts * import { canGrowBoard, createGame } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(canGrowBoard(state)); * ``` */ export declare function canGrowBoard(state: GameState): boolean; /** * Returns the game on a larger board, or the state unchanged when it cannot * grow. Every stone, every recorded move and the winning line all move * together, so the record still replays to the position on the screen. * * @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, growBoard } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(growBoard(state)); * ``` */ export declare function growBoard(state: GameState): GameState; /** The next size down, or null when the board is already the smallest. * * @param size - The number of cells on each side of the board. * @param sizes - The supported side lengths in ascending order. * @returns The previous supported size, or null at the smallest size. * @example * ```ts * import { previousBoardSize } from "@johnmorrisdotca/narabe"; * * console.log(previousBoardSize(13,[9,13,19])); * ``` */ export declare function previousBoardSize(size: number, sizes?: readonly number[]): number | null; /** * Whether the ring that shrinking would remove holds any recorded move. * * This asks the record, not the board, and the difference matters. A captured * stone leaves the board but its move stays in the list, and a piece that * slid inwards leaves a move whose `from` is still out there. Either would * replay as a stone placed outside the smaller board, so a ring that looks * empty can still be occupied as far as the record is concerned. */ export declare function ringHoldsMoves(state: GameState, margin: number): boolean; /** Whether resizing is enabled and a smaller native board is available. * * @param state - The current immutable game position. * @returns Whether resizing is enabled and a smaller native board is available. * @example * ```ts * import { canShrinkBoard, createGame } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(canShrinkBoard(state)); * ``` */ export declare function canShrinkBoard(state: GameState): boolean; /** * Returns the game on a smaller board, or the state unchanged when the ring * that would be removed is in use. Everything shifts inwards by the same * offset growing shifts out by, so the stones keep their positions relative * to each other and the centre stays the centre. * * @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, shrinkBoard } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(shrinkBoard(state)); * ``` */ export declare function shrinkBoard(state: GameState): GameState;