import type { Cell, GameSettings, Handicap, Point, Stone } from "../types.ts"; /** * A second, independent reading of the board for the simulator: a plain scan * in every direction that knows nothing of the engine's incremental checks. * Every rule it needs — wrapping, wormholes, what a run is — is restated here * by hand, so that a mistake in the engine cannot also be a mistake here. */ /** * Whether a run of `length` wins for `stone`, restated from each variant's * published rules rather than read from VARIANT_SPECS. * * Sharing the engine's own table would make the cross-check below a tautology, * so these are written out by hand. `blockedEnds` counts how many ends of the * run are shut in by something — an opposing stone or an obstacle. The edge of * the board is not one of those, here or in the engine: a line lying against * the side is not sealed by it. * * `handicap` is the game's handicap, whoever it belongs to. It is read here * rather than left out because a handicap can decide a win rather than refuse * a move — and a check that ignores it calls a line of six a win where the * engine has correctly refused one, then reports the ENGINE as the mistake. * That is not a cross-check failing; that is a cross-check lying. */ export declare function runWinsIndependently(variant: string, stone: Stone, length: number, blockedEnds: number, winLength: number, handicap?: Handicap): boolean; /** * Which edges a variant joins, restated by hand: the ring game is a cylinder, * the toroidal game a torus, everything else a plain board. */ export declare function wrapsOf(variant: string): "none" | "columns" | "both"; export declare function bruteForceWinner(board: Cell[], settings: GameSettings): Stone | null; /** Every invariant that must hold after any legal move. */ /** The longest unbroken run of `stone` through `point`, in any direction. */ export declare function longestRunThrough(board: Cell[], size: number, point: Point, stone: Stone): number; export declare function flipsByHand(board: Cell[], size: number, stone: Stone, point: Point, directions?: readonly [number, number][]): Point[]; /** Discs of each colour, counted the plain way. */ export declare function countByHand(board: Cell[]): { black: number; white: number; }; /** Whether `stone` has any legal flip anywhere on the board, by the hand scan. */ export declare function canFlipAnywhereByHand(board: Cell[], size: number, stone: Stone, directions?: readonly [number, number][]): boolean; /** Which directions a flipping game's runs lie along, by the game's name rather than its spec. */ export declare function flipDirectionsByHand(variant: string): readonly [number, number][];