import type { Cell, GameState, Point, Stone } from "../types.ts"; /** * THE MILL GAMES: three squares, one inside another, joined at the middle of each * side, twenty-four points in all. Each player lays a set of men, then moves them along * the lines, and three men in a line (a mill) take one of the other side's off the board. * * The board is laid out on a seven by seven grid of points so that the rest of the engine * reads it as it reads any other: a point that is not one of the twenty-four is sealed * off as BLOCKED when the board is made, as Chinese Checkers' star is. Lines and neighbours * come from the drawing below, because on this board being next to a point on the grid * says nothing: (0, 0) and (1, 1) are not joined. * * The removal is the second half of the same turn. While it is owed, `isLegalMove` and * `playMove` read "the point played" as the man to take, so a replay, the * programs and a page's own press have one way to say it, and nothing else needs to know. */ /** The twenty-four points, ring by ring. */ export declare const MILL_POINTS: readonly Point[]; /** Every run of three along a drawn line: the eight sides of the rings and the four spokes, each way. */ export declare const MILLS: readonly (readonly Point[])[]; /** Whether this place on the grid is one of the twenty-four. */ export declare function isMillPoint(point: Point): boolean; /** The points a man here is joined to. */ export declare function millNeighbours(point: Point): readonly Point[]; /** Whether a man at `point` stands in three of its colour along a drawn line. */ export declare function inMill(board: readonly Cell[], point: Point, stone: Stone): boolean; /** The men of this colour that may be taken: any not in a mill, or, when every one is, any. */ export declare function takeableMen(board: readonly Cell[], stone: Stone): Point[]; /** How many men this colour has laid so far: the board cannot say, once men have been taken. */ export declare function menLaid(state: GameState, stone: Stone): number; /** How many men each side has to lay. */ export declare function menEach(state: GameState): number; /** Whether this colour has laid all its men. */ export declare function allLaid(state: GameState, stone: Stone): boolean; /** How many men of this colour are on the board. */ export declare function menOnBoard(board: readonly Cell[], stone: Stone): number; /** Where a man of this colour may go: along a line to an empty point, or, down to three men, to any empty point at all (the flying rule). */ export declare function millMoves(board: readonly Cell[], from: Point, stone: Stone): Point[]; /** Whether this colour has any move at all, once its men are down. */ export declare function hasMillMove(board: readonly Cell[], stone: Stone): boolean; /** The other colour. */ export declare function otherMan(stone: Stone): Stone;