/** * Conversion utilities between square notation and internal indices */ import { Square, SquareIndex, FileIndex, RankIndex } from '../types'; /** * Convert square notation (e.g., "A1", "E4") to square index (0-63) * * Board layout: * 56 57 58 59 60 61 62 63 (Rank 8) - A8 to H8 * 48 49 50 51 52 53 54 55 (Rank 7) * ... * 8 9 10 11 12 13 14 15 (Rank 2) * 0 1 2 3 4 5 6 7 (Rank 1) - A1 to H1 * * @param square - Square notation (case-insensitive) * @returns Square index (0-63) * @throws Error if square notation is invalid */ export declare function squareToIndex(square: Square): SquareIndex; /** * Convert square index (0-63) to square notation (e.g., "A1", "E4") * * @param index - Square index (0-63) * @returns Square notation in uppercase * @throws Error if index is out of range */ export declare function indexToSquare(index: SquareIndex): Square; /** * Get file index (0-7) from square index * * @param index - Square index (0-63) * @returns File index (0=A, 1=B, ..., 7=H) */ export declare function getFileIndex(index: SquareIndex): FileIndex; /** * Get rank index (0-7) from square index * * @param index - Square index (0-63) * @returns Rank index (0=1, 1=2, ..., 7=8) */ export declare function getRankIndex(index: SquareIndex): RankIndex; /** * Get file from square notation * * @param square - Square notation (case-insensitive) * @returns File index (0-7) */ export declare function getFile(square: Square): FileIndex; /** * Get rank from square notation * * @param square - Square notation (case-insensitive) * @returns Rank index (0-7) */ export declare function getRank(square: Square): RankIndex; /** * Create square index from file and rank indices * * @param file - File index (0-7) * @param rank - Rank index (0-7) * @returns Square index (0-63) */ export declare function fileRankToIndex(file: FileIndex, rank: RankIndex): SquareIndex; /** * Check if square notation is valid * * @param square - Square notation * @returns true if valid */ export declare function isValidSquare(square: string): boolean; /** * Check if square index is valid * * @param index - Square index * @returns true if valid (0-63) */ export declare function isValidIndex(index: number): boolean; /** * Convert square index to bitboard (single bit set) * * @param index - Square index (0-63) * @returns Bitboard with single bit set */ export declare function indexToBitboard(index: SquareIndex): bigint; /** * Convert square notation to bitboard * * @param square - Square notation * @returns Bitboard with single bit set */ export declare function squareToBitboard(square: Square): bigint; /** * Get all set bits (square indices) from a bitboard * * @param bitboard - Bitboard to extract indices from * @returns Array of square indices where bits are set */ export declare function bitboardToIndices(bitboard: bigint): SquareIndex[]; /** * Get the index of the lowest set bit in a bitboard (O(1) via De Bruijn) */ export declare function getLowestSetBit(bitboard: bigint): SquareIndex; /** * Get the index of the highest set bit in a bitboard */ export declare function getHighestSetBit(bitboard: bigint): SquareIndex; /** * Count the number of set bits in a bitboard (population count) * * @param bitboard - Bitboard * @returns Number of set bits */ export declare function popCount(bitboard: bigint): number; /** * Calculate Manhattan distance between two squares * * @param from - Source square index * @param to - Target square index * @returns Manhattan distance */ export declare function manhattanDistance(from: SquareIndex, to: SquareIndex): number; /** * Calculate Chebyshev distance between two squares (king moves) * * @param from - Source square index * @param to - Target square index * @returns Chebyshev distance */ export declare function chebyshevDistance(from: SquareIndex, to: SquareIndex): number; /** * Check if a square is on the edge of the board * * @param index - Square index * @returns true if on edge */ export declare function isOnEdge(index: SquareIndex): boolean; /** * Check if square is on A-file */ export declare function isAFile(index: SquareIndex): boolean; /** * Check if square is on H-file */ export declare function isHFile(index: SquareIndex): boolean; /** * Check if square is on rank 1 */ export declare function isRank1(index: SquareIndex): boolean; /** * Check if square is on rank 8 */ export declare function isRank8(index: SquareIndex): boolean; //# sourceMappingURL=conversion.d.ts.map