INNER CODE UNIT · TypeScript

move

josefjadrny/js-chess-engine · src/index.ts:445

export function move(config: BoardConfig | string, from: string, to: string): BoardConfig {
    const game = new Game(config);
    return game.move(from, to);
}

/**
 * Make an AI move (v1 compatible - returns only the move)
 *
 * @deprecated Use `ai()` instead. This function will be removed in v3.0.0.
 * @param config - Board configuration or FEN string
 * @param level - AI level (1-5, default 3)
 * @returns The played move object (e.g., {"E2": "E4"})
 */
export function aiMove(config: BoardConfig | string, level: number = 3): HistoryEntry {
    const game = new Game(config);
    return game.aiMove(level);
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…