import type { Cell, GameSettings, LineRule, Point, Stone, WrapMode } from "../types.ts"; /** The line rule that applies to `stone` under these settings. */ export declare function lineRuleFor(settings: GameSettings, stone: Stone): LineRule; /** A contiguous run of one colour along a line, with the cells just past it. */ export type Run = { cells: Point[]; /** The cell before the first stone and after the last; undefined off the board. */ ends: [Cell | undefined, Cell | undefined]; }; /** How a line travels beyond plain steps: joined edges, and wormhole pairs. */ export type LineWorld = { wrap: WrapMode; /** Board index of each wormhole mouth to its partner. */ links: ReadonlyMap; }; /** * Walks from `origin` in `step` increments while the stones match, returning * the points visited (excluding `origin`). On a wrapping board the walk is * capped at the board's width, or a full ring would never end. */ export declare function runFrom(board: Cell[], size: number, origin: Point, step: Point, stone: Stone, wrap?: WrapMode | LineWorld): Point[]; /** The whole run of `stone` through `point` along `step`, in line order. */ export declare function runThrough(board: Cell[], size: number, point: Point, step: Point, stone: Stone, wrap?: WrapMode | LineWorld): Run; /** The line world for these settings: wrapping and wormholes, from the seed. */ export declare function lineWorld(settings: GameSettings): LineWorld; /** * Whether a run wins under `rule`. `ends` are the two cells just beyond the * run, which only the caro rule looks at: a five with an enemy stone (or an * obstacle) at both ends is shut in and does not count. */ export declare function runWins(rule: LineRule, run: Run, winLength: number, stone: Stone): boolean; /** * The winning line through `point`, if the stone there completes one under * the rule that applies to its colour. Only lines through the given point are * examined, which is all that can change after a single move. Returns an * empty array when there is no win. * * @param board - The row-major board cells; null marks an empty point. * @param settings - The native game settings to interpret. * @param point - A zero-based row and column on the board. * @returns The winning line through the point, or an empty array without one. * @example * ```ts * import { createGame, findWinningLine } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * const point = {row:7,col:7}; * console.log(findWinningLine(state.board,state.settings,point)); * ``` */ export declare function findWinningLine(board: Cell[], settings: GameSettings, point: Point): Point[]; /** * The winning line of `stone` through `point`, whatever sits at `point` — a * hotspot completes a line for either colour, so both are asked. */ export declare function winningLineFor(board: Cell[], settings: GameSettings, point: Point, stone: Stone): Point[];