import type { Cell, GameState, Point, Stone } from "../types.ts"; /** * The checkers family, restated by hand for the simulator: every game's rules * written out here as plain facts, and every question the checker asks worked * out from them afresh — never read from VARIANT_SPECS or rules/checkers.ts, * so a wrong row there cannot agree with itself. * * The representation is deliberately not the engine's either. The engine lifts * each captured piece at once and remembers the squares; here a sequence is * searched with the taken pieces left standing on the board, as the rulebooks * describe it, and the longest capture is found by trying every route with no * memo at all. */ export type HandRules = { size: number; rows: number; backward: boolean; flying: boolean; most: boolean; crown: "stops" | "continues" | "passes"; /** Plies of kings moving with nothing taken before a draw. */ idlePlies: number; repetition: number | null; /** * Named endings, each side written K for a king and M for a man, kings * first, with `restarts` when a capture or crowning inside them starts the * count again; or a balance — any ending of so many pieces with a king on * each side, counted while nothing is taken or crowned. */ endings: ({ kind: "endings"; pairs: [string, string][]; restarts: boolean; movesEach: number; } | { kind: "balance"; pieces: number[]; movesEach: number; })[]; }; export declare const HAND_RULES: Record; export declare function farRowByHand(size: number, stone: Stone): number; export declare function isKingByHand(kings: readonly Point[], at: Point): boolean; /** Every single jump from `from`, with the taken pieces still standing on `board`. */ export declare function hopsByHand(board: readonly Cell[], size: number, from: Point, stone: Stone, king: boolean, hand: HandRules, taken: readonly number[], origin: number): { to: Point; over: Point; }[]; /** The most pieces a capture can go on to take from `at`, by trying every route there is. */ export declare function bestByHand(board: readonly Cell[], size: number, at: Point, stone: Stone, king: boolean, hand: HandRules, taken: readonly number[], origin: number): number; /** The longest capture any of `stone`'s pieces has, or 0 when none can take. */ export declare function bestAnywhereByHand(board: readonly Cell[], kings: readonly Point[], size: number, stone: Stone, hand: HandRules): number; /** Whether `stone` has anything at all to play: a capture, or a step. */ export declare function anyMoveByHand(board: readonly Cell[], kings: readonly Point[], size: number, stone: Stone, hand: HandRules): boolean; /** * Which of its own draws a position has reached, worked out by walking the * record back over a copy of the whole board, or null for none. */ export declare function drawReasonByHand(state: GameState, hand: HandRules): string | null;