import type { GameSettings, GameState, MoveKind, PieceCell, Point, Stone, TurnChoices } from "./types.ts"; /** A React game state and its native move, replay and reset actions. * * @example * ```ts no-run * import { createElement } from "react"; * import { useNarabe, type NarabeGame } from "@johnmorrisdotca/narabe/react"; * function Board() { * const game: NarabeGame = useNarabe({variant:"reversi"}); * return createElement("p",null,game.state.toPlay); * } * console.log(createElement(Board)); * ``` */ export type NarabeGame = { /** The game as it stands. A new object after every move that changed it. */ state: GameState; /** What the player to move may do, or null when there is no set of moves to show. See `turnChoices`. */ choices: TurnChoices | null; /** Places a stone at `point`: `playMove`. `colour` is for the games where the mover chooses it. */ play: (point: Point, kind?: MoveKind, colour?: Stone | null) => void; /** Moves a piece: `movePiece`. */ move: (from: Point, to: Point) => void; /** Lays a queued piece on these cells: `placePiece`. */ place: (cells: readonly PieceCell[]) => void; /** Turns a quadrant to finish a twist game's move: `twistBoard`. */ twist: (quadrant: number, clockwise: boolean) => void; /** Passes the turn where the rules allow it: `passTurn`. */ pass: () => void; /** Takes back the last move, where there is one to take back. */ undo: () => void; canUndo: boolean; /** Starts again, with these settings or the ones this game began with. */ reset: (settings?: Partial) => void; }; /** * One game, kept in React state. * * `settings` is read when the hook first runs and again on `reset`; give it a * `seed` for a game that starts the same way every time. * * @param settings - The native game settings to interpret. * @returns The current position, available choices and native action callbacks. * @example * ```ts no-run * import { createElement } from "react"; * import { useNarabe } from "@johnmorrisdotca/narabe/react"; * function Board() { * const game = useNarabe({variant:"reversi"}); * return createElement("p",null,game.state.toPlay); * } * console.log(createElement(Board)); * ``` */ export declare function useNarabe(settings?: Partial): NarabeGame;