/** * Transposition Table for js-chess-engine v2 * * Stores previously evaluated positions to avoid re-computation. * Uses Zobrist hashing for position identification. */ import { InternalMove } from '../types'; import { Score } from '../types/ai.types'; /** * Get recommended TT size for a given AI level and environment * * NOTE: TT size directly affects AI strength. Larger TT = better move ordering * and fewer re-searches, which improves play quality at higher depths. * * @param level - AI difficulty level (1-5) * @returns Recommended TT size in MB */ export declare function getRecommendedTTSize(level: number): number; /** * Types of transposition table entries */ export declare enum TTEntryType { EXACT = 0,// Exact score LOWER_BOUND = 1,// Alpha cutoff (fail-high) UPPER_BOUND = 2 } /** * Transposition table entry */ export interface TTEntry { zobristHash: bigint; depth: number; score: Score; type: TTEntryType; bestMove: InternalMove | null; age: number; } /** * Transposition Table * * Implements a hash table with replacement strategy for storing * previously evaluated positions. */ export declare class TranspositionTable { private table; private size; private currentAge; private hits; private misses; /** * Create a new transposition table * * @param sizeMB - Size in megabytes (default: 16MB) */ constructor(sizeMB?: number); /** * Store a position in the transposition table * * @param zobristHash - Position hash * @param depth - Search depth * @param score - Position score * @param type - Entry type * @param bestMove - Best move found */ store(zobristHash: bigint, depth: number, score: Score, type: TTEntryType, bestMove: InternalMove | null, ply?: number): void; /** * Probe the transposition table * * @param zobristHash - Position hash * @param depth - Current search depth * @param alpha - Alpha bound * @param beta - Beta bound * @returns Entry if found and usable, null otherwise */ probe(zobristHash: bigint, depth: number, alpha: Score, beta: Score, ply?: number): TTEntry | null; /** * Get best move from transposition table (for move ordering) * * @param zobristHash - Position hash * @returns Best move if found, null otherwise */ getBestMove(zobristHash: bigint): InternalMove | null; /** * Clear the transposition table */ clear(): void; /** * Increment search age (call at start of new search) */ newSearch(): void; /** * Get index for a hash value * * @param hash - Zobrist hash * @returns Table index */ private getIndex; /** * Get cache statistics * * @returns Statistics object */ getStats(): { hits: number; misses: number; hitRate: number; size: number; }; } //# sourceMappingURL=TranspositionTable.d.ts.map