/** * AI Engine for js-chess-engine v2 * * Orchestrates the AI search and provides level-based difficulty settings. */ import { InternalBoard, InternalMove } from '../types'; import { AILevel, SearchResult } from '../types/ai.types'; /** * AI difficulty level configuration * Maps AI levels (1-5) to search depths */ interface LevelConfig { baseDepth: number; extendedDepth: number; checkExtension: boolean; qMaxDepth: number; } /** * AI Engine class * Manages AI move selection and search */ export declare class AIEngine { private search; private currentTTSize; constructor(); /** * Find the best move for the current position * * @param board - Current board state * @param level - AI difficulty level (1-5, default 3) * @param ttSizeMB - Transposition table size in MB (0 to disable, min 0.25 MB, auto-scaled by level) * @returns Best move found by the AI */ findBestMove(board: InternalBoard, level?: AILevel, ttSizeMB?: number, depth?: { base?: number; extended?: number; check?: boolean; quiescence?: number; }, randomness?: number): InternalMove | null; /** * Find the best move, including optional analysis (root move scores). * * Used by the public `ai(..., { analysis: true })` API. */ findBestMoveDetailed(board: InternalBoard, options?: { level?: AILevel; ttSizeMB?: number; depth?: { base?: number; extended?: number; check?: boolean; quiescence?: number; }; analysis?: boolean; randomness?: number; }): SearchResult | null; /** * Get the search depth for a given AI level * * @param level - AI level (1-5) * @returns Depth configuration */ static getLevelDepth(level: AILevel): LevelConfig; /** * Adaptive depth heuristic. * * Contract: * - Input: board + baseDepth (from level) * - Output: adjusted depth (>= 1) * * Heuristic goals: * - Never search shallower than the requested level depth. * - If there are very few root legal moves (tactical / constrained), allow +1. * - If the position is simplified (few pieces), allow +1 or +2. */ private getAdaptiveDepth; } export {}; //# sourceMappingURL=AIEngine.d.ts.map