import type { CardGameKind } from "./games/card-games.constants.ts";
import type { GameOf, MoveOf, NewGameOptions } from "./play.ts";
/**
* A card game in React state: the game, the moves the person to play may
* make, and `play` to make one. Computers take their turns by themselves,
* one move every `computerDelay` milliseconds, so a person can follow them.
* Drawing the table is yours: this holds the game and nothing else.
*
* ```tsx
* const table = useCardGame("crazyEights", { players: ["You", "Ann"], computers: [false, true] });
* table.moves.map((move) => );
* ```
*
* @example
* ```ts no-run
* import type { CardGameState } from "@johnmorrisdotca/toranpu/react";
* import { useCardGame } from "@johnmorrisdotca/toranpu/react";
*
* function Table() {
* const value: CardGameState<"hearts"> = useCardGame("hearts", { players: ["Aki", "Ben", "Cy", "Dev"], seed: 42 });
* console.log(value.moves.length);
* return null;
* }
* console.log(Table.name);
* ```
*/
export type CardGameState = {
/** The game now, or null when the table was one the game is not offered for. */
game: GameOf | null;
/** The seat to move, or null once the game is over. */
toPlay: number | null;
/** Whether the seat to move is a computer's. */
computerToPlay: boolean;
/** The moves the seat to move may make: none while a computer is thinking or once the game is over. */
moves: readonly MoveOf[];
over: boolean;
/** Every seat that won, once the game is over. */
winners: readonly number[];
/** Make a move for the person to play. Returns false for a move the rules refuse. */
play: (move: MoveOf) => boolean;
/** Deal a new game with the same table and a new seed, or the options given. */
restart: (options?: Partial) => void;
};
/** A card game held in React state. See `CardGameState` for what it hands back; `computerDelay` is the milliseconds a computer waits before each move.
*
* @param kind - The named card game or sound kind.
* @param options - Options for this call; omitted fields retain their documented defaults.
* @param computerDelay - Milliseconds between computer turns in the React view.
* @returns A card game held in React state. See `CardGameState` for what it hands back; `computerDelay` is the milliseconds a computer waits before each move.
*
* @example
* ```ts no-run
* import { useCardGame } from "@johnmorrisdotca/toranpu/react";
*
* import { createElement } from "react";
* function Table() {
* const table = useCardGame("hearts", { players: ["You", "Aki", "Ben", "Cy"], seed: 42 });
* return createElement("p", null, `${table.moves.length} legal moves`);
* }
* console.log(createElement(Table));
* ```
*/
export declare function useCardGame(kind: K, options: NewGameOptions, computerDelay?: number): CardGameState;