import type { Cell, Point, Stone } from "../types.ts"; /** * Chinese Checkers: a hexagram (Star of David) board, one point of it * filled with each side's pieces at the start, racing to be first to fill * the point directly opposite. A move is a step to a neighbouring empty * cell, or a jump over an adjacent piece of either colour into the empty * cell straight beyond it, with a chain of jumps in the same move — exactly * Halma's mechanic (see `camps.ts`), translated from a square board's eight * directions onto a hex lattice's six. Nothing is ever captured. * * The board is embedded in a square Point{row,col} grid the way Hex's * rhombus is: the six directions below are axial hex-grid steps, and * `inStar` marks which cells of the square actually belong to the * hexagram. Every other cell is sealed off with the same `BLOCKED` obstacle * the drop games scatter at random — here laid down once, by shape, when * the game is created. */ /** * How many rows deep each of the star's six points is. The board's centre * hexagon has the same radius, and the standard 121-hole set is radius 4: * a 61-cell hexagon plus six 10-cell points. * * @example * ```ts * import { STAR_RADIUS } from "@johnmorrisdotca/narabe"; * console.log(STAR_RADIUS); * ``` */ export declare const STAR_RADIUS = 4; /** The side of the square array a star of this radius is embedded in. * * @param radius - The Chinese Checkers star radius. * @returns The side of the square array a star of this radius is embedded in. * @example * ```ts * import { STAR_RADIUS, starSize } from "@johnmorrisdotca/narabe"; * * console.log(starSize(STAR_RADIUS)); * ``` */ export declare function starSize(radius?: number): number; /** * Whether `point` is one of the hexagram's playable cells. * * A hexagram of radius N is provably the union of two triangles of side 3N, * centred on the same point and each the other rotated 180°: {min(x,y,z) >= * -N} is one triangle, {max(x,y,z) <= N} the other, and their overlap — * where both hold — is exactly the centre hexagon of radius N. For N=4 that * union comes to 121 cells, ten to a point, which is the board this game is * always sold with. */ /** * How many cells the hexagram actually has: counted, not quoted. The figure * everybody knows is 121, and it is written in the comment above — but a * comment is not a board, and this is read by the copy that tells a player * what they are looking at. */ export declare function starCells(size: number): number; export declare function inStar(radius: number, point: Point): boolean; /** * THE STAR'S SIX POINTS, clockwise from the top as the board is drawn. Each is * the ten cells where one cube coordinate runs past the centre hexagon's * radius: `top` is z < -R, and its opposite `bottom` is z > R; the other four * pair off the same way on x and y. The two-player game uses `top` (black) and * `bottom` (white); a game for three, four or six sits more players on the * others (`party/partyCheckers.ts`). Named for where they are drawn, since the * lattice's shear puts `upperRight` up and to the right, and so on round. */ export declare const STAR_TIPS: readonly ["top", "upperRight", "lowerRight", "bottom", "lowerLeft", "upperLeft"]; export type StarTip = (typeof STAR_TIPS)[number]; /** The point directly across the star: where a piece starting at `tip` is racing to. */ export declare function oppositeTip(tip: StarTip): StarTip; /** * Every cell of one of the star's six points, in reading order (row by row, * left to right) — the order the two camps have always been listed in, which * the tests and the bots' first moves read. */ export declare function starTipCells(radius: number, tip: StarTip): Point[]; /** Which of the six points `point` lies in, or null in the centre hexagon or off the star. */ export declare function starTipOf(radius: number, point: Point): StarTip | null; /** Pieces a side has: the cells of one point, ten on the standard board. * * @param radius - The Chinese Checkers star radius. * @returns Pieces a side has: the cells of one point, ten on the standard board. * @example * ```ts * import { STAR_RADIUS, starCampSize } from "@johnmorrisdotca/narabe"; * * console.log(starCampSize(STAR_RADIUS)); * ``` */ export declare function starCampSize(radius: number): number; /** * The squares of a colour's home point: black starts at the top, white at * the bottom, the same "black starts near, white starts far" convention * `camps.ts` uses for Halma's corners. */ export declare function starCampSquares(radius: number, stone: Stone): Point[]; /** Whose home point `point` lies in, or null outside both. * * @param radius - The Chinese Checkers star radius. * @param point - A zero-based row and column on the board. * @returns The starting star-camp colour, or null outside both camps. * @example * ```ts * import { STAR_RADIUS, starCampOf } from "@johnmorrisdotca/narabe"; * * console.log(starCampOf(STAR_RADIUS,{row:0,col:8})); * ``` */ export declare function starCampOf(radius: number, point: Point): Stone | null; /** Every piece on the board when the game starts: each colour filling its own point. */ export declare function starStartingPieces(radius: number): { point: Point; stone: Stone; }[]; /** * Where a piece at `from` may go: any empty neighbouring cell along the six * hex directions, or the end of any chain of jumps over an adjacent piece of * either colour into the empty cell straight beyond it. Identical to * `campMoves`, six directions in place of eight; the hexagram's own shape is * enforced by the `BLOCKED` cells outside it, never checked here directly. */ export declare function starMoves(board: Cell[], size: number, from: Point): Point[]; /** * Whether `stone` has won: the far point — the other colour's home — is * full, and at least one piece in it is theirs. The same rule as Halma's * `campFilled`, read against a star point instead of a square corner. */ export declare function starFilled(board: Cell[], size: number, radius: number, stone: Stone): boolean; /** How many of `stone`'s pieces stand in the far point. * * @param board - The row-major board cells; null marks an empty point. * @param size - The number of cells on each side of the board. * @param radius - The Chinese Checkers star radius. * @param stone - The black or white colour being examined. * @returns How many of `stone`'s pieces stand in the far point. * @example * ```ts * import { STAR_RADIUS, createGame, starPiecesHome } from "@johnmorrisdotca/narabe"; * * const star = createGame({variant:"chineseCheckers"}); * console.log(starPiecesHome(star.board,star.settings.size,STAR_RADIUS,"black")); * ``` */ export declare function starPiecesHome(board: Cell[], size: number, radius: number, stone: Stone): number;