feat : add stockfish 17

This commit is contained in:
GuillaumeSD
2025-01-07 00:43:58 +01:00
parent 151277524b
commit 49bbc87fa5
18 changed files with 121 additions and 22 deletions

View File

@@ -0,0 +1,27 @@
import { EngineName } from "@/types/enums";
import { UciEngine } from "./uciEngine";
import { isMultiThreadSupported, isWasmSupported } from "./shared";
import { getEngineWorker } from "./worker";
export class Stockfish17 {
public static async create(lite?: boolean): Promise<UciEngine> {
if (!Stockfish17.isSupported()) {
throw new Error("Stockfish 17 is not supported");
}
const enginePath = lite
? "engines/stockfish-17/stockfish-17-lite-02843c1.js"
: "engines/stockfish-17/stockfish-17-aaa11cd.js";
const engineName = lite
? EngineName.Stockfish17Lite
: EngineName.Stockfish17;
const worker = getEngineWorker(enginePath);
return UciEngine.create(engineName, worker);
}
public static isSupported() {
return isWasmSupported() && isMultiThreadSupported();
}
}