import type { Cell, GameSettings, GameState, Point, StartingDiscs, Stone } from "../types.ts"; /** The four centre squares, top-left first. Even boards only; the centre is between four cells. * * @param size - The number of cells on each side of the board. * @returns The four centre squares, top-left first. Even boards only; the centre is between four cells. * @example * ```ts * import { centreSquares } from "@johnmorrisdotca/narabe"; * * console.log(centreSquares(8)); * ``` */ export declare function centreSquares(size: number): Point[]; /** How the centre four begin: the players' choice in the settings, else the game's rule. */ export declare function openingFor(settings: GameSettings): StartingDiscs; /** * The directions a run may lie along: the eight of a square board, or the six * of the honeycomb's lattice. Read from the spec, so a flipping game on a new * shape changes one row here and nothing in the flipping itself. */ export declare function flipDirections(settings: GameSettings): readonly Point[]; /** The fixed opening: white top-left and bottom-right, black the other diagonal — or the honeycomb's ring of six. */ export declare function startingDiscs(settings: GameSettings): { point: Point; stone: Stone; }[]; /** Classic reversi: the first four discs are laid by the players, in the centre, with no flipping. * * @param state - The current immutable game position. * @returns Classic reversi: the first four discs are laid by the players, in the centre, with no flipping. * @example * ```ts * import { createGame, inLayingPhase } from "@johnmorrisdotca/narabe"; * * const state = createGame({variant:"freestyle",size:15}); * console.log(inLayingPhase(state)); * ``` */ export declare function inLayingPhase(state: GameState): boolean; /** * The discs a stone of `stone` at `point` would turn. Empty means the move is * illegal. `directions` is the square board's eight unless a caller says * otherwise; everything that has a state to hand reads `flipDirections`. * * @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 stone - The black or white colour being examined. * @param point - A zero-based row and column on the board. * @param directions - The board directions in which discs can flip. * @returns The discs a stone of `stone` at `point` would turn. Empty means the move is illegal. `directions` is the square board's eight unless a caller says otherwise; everything that has a state to hand reads `flipDirections`. * @example * ```ts * import { createGame, flipsAt } from "@johnmorrisdotca/narabe"; * * const reversi = createGame({variant:"reversi"}); * console.log(flipsAt(reversi.board,8,"black",{row:2,col:3})); * ``` */ export declare function flipsAt(board: Cell[], size: number, stone: Stone, point: Point, directions?: readonly Point[]): Point[]; /** Whether a stone of `stone` may go at `point`: in the laying phase a centre square, otherwise a flip. */ export declare function flipLegal(state: GameState, point: Point): boolean; /** Whether the colour has a legal disc-flipping move. * * @param state - The current immutable game position. * @param stone - The black or white colour being examined. * @returns Whether the colour has a legal disc-flipping move. * @example * ```ts * import { createGame, hasFlipMove } from "@johnmorrisdotca/narabe"; * * const reversi = createGame({variant:"reversi"}); * console.log(hasFlipMove(reversi,"black")); * ``` */ export declare function hasFlipMove(state: GameState, stone: Stone): boolean; /** Count black and white discs currently on a board. * * @param board - The row-major board cells; null marks an empty point. * @returns Count black and white discs currently on a board. * @example * ```ts * import { createGame, discCount } from "@johnmorrisdotca/narabe"; * * const reversi = createGame({variant:"reversi"}); * console.log(discCount(reversi.board)); * ``` */ export declare function discCount(board: Cell[]): Record; /** * Plays a stone in a flipping game: it goes down, the flanked discs turn, * and the turn goes to whoever can move — the other colour if they can, * the same colour again if only they can, and to the count if nobody can. */ export declare function playFlip(state: GameState, point: Point): GameState; /** The end of a flipping game: more discs wins, or fewer in the giveaway form; equal is a draw. */ export declare function settleCount(state: GameState): GameState; /** * Undo, for a flipping game: the discs the last move turned must turn back, * and which those were is not on the record — so the position is rebuilt * from the start through every move but the last. A stored game is a move * list; replaying it is the one operation guaranteed to agree with itself. */ export declare function undoFlip(state: GameState, start: GameState): GameState;