import type { GameSettings } from "./types.ts"; /** * How long a game can get, and whether anything stops it. * * John's question is about cost rather than patience: a game that never ends * is a row written to, read and drawn for ever. The answer is not the same for * every game here, and the difference is mechanical rather than a matter of * degree. * * A placement game is bounded by its own board. Every move fills a point and * no point is ever given back, so the longest possible game is the number of * points there are to fill. That bound is reached in practice — Hex ran the * full 361 on 19×19, Caro the full 225 on 15×15 — and since 0.104.3 it is * actually reached rather than approached, because a position nobody can move * in now ends instead of stopping. * * Two mechanisms break that. A game that CAPTURES gives points back, and a * game that CLEARS a row does the same wholesale, so both can run longer than * the board is wide: Sannuki managed 97 moves on 81 points, and Go — which * captures freely — managed 321 on 81 and 444 on 361. Go is held by its own * two-pass ending rather than by the board. * * The games where pieces MOVE are the ones with nothing holding them at all. * A slide neither fills a point nor empties one, so the position can wander * for ever, and there is no repetition rule and no fifty-move rule to stop it. * Measured rather than assumed: Halma and Chinese Checkers were still playing * after sixty thousand random moves, at every board size and every seed tried. * Not slow — unbounded. * * Checkers is the exception among them, and for a reason worth keeping: a * capture removes a piece and pieces are never added, so material runs down * and the game converges. It finished in 48, 49 and 108 moves. The rules still * do not FORCE that — two kings can shuffle for ever — so it is counted here * with the unbounded ones. What is measured is what random play does; what is * returned is what the rules guarantee. */ /** Why a game has no bound, or null when the board is its bound. * * @example * ```ts * import type { NoBoundReason } from "@johnmorrisdotca/narabe"; * * const value: NoBoundReason = "captures"; * console.log(value); * ``` */ export type NoBoundReason = "pieces-move" | "captures" | "line-clear"; /** * The most moves a game of these settings can contain, or null when nothing * in the rules bounds it. * * Read from the spec rather than from a list of variant names, so a game added * tomorrow is classified the day it lands. * * @param settings - The native game settings to interpret. * @returns The board-based maximum move count, or null when captures, clearing or moving pieces remove that bound. * @example * ```ts * import { createGame, longestPossibleGame } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(longestPossibleGame(state.settings)); * ``` */ export declare function longestPossibleGame(settings: GameSettings): number | null; /** * What stops this game being bounded by its board, or null when nothing does. * * Order matters only for the answer given to a reader: a game that both moves * pieces and captures is unbounded for the first reason, which is the stronger * one — captures at least run material down, and sliding does not. * * @param settings - The native game settings to interpret. * @returns The mechanism that removes the board bound, or null when placements alone bound the game. * @example * ```ts * import { createGame, noBoundReason } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(noBoundReason(state.settings)); * ``` */ export declare function noBoundReason(settings: GameSettings): NoBoundReason | null; /** Whether the rules alone guarantee this game ends. * * @param settings - The native game settings to interpret. * @returns Whether the rules alone guarantee this game ends. * @example * ```ts * import { createGame, endsOnItsOwn } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(endsOnItsOwn(state.settings)); * ``` */ export declare function endsOnItsOwn(settings: GameSettings): boolean;