fix : engine parallel workers

This commit is contained in:
GuillaumeSD
2025-04-20 03:49:15 +02:00
parent 61c90b9c6b
commit 3e9523c49f
12 changed files with 137 additions and 108 deletions

View File

@@ -4,7 +4,10 @@ import { isMultiThreadSupported, isWasmSupported } from "./shared";
import { getEngineWorkers } from "./worker";
export class Stockfish17 {
public static async create(lite?: boolean): Promise<UciEngine> {
public static async create(
lite?: boolean,
workersNb?: number
): Promise<UciEngine> {
if (!Stockfish17.isSupported()) {
throw new Error("Stockfish 17 is not supported");
}
@@ -20,7 +23,7 @@ export class Stockfish17 {
? EngineName.Stockfish17Lite
: EngineName.Stockfish17;
const workers = getEngineWorkers(enginePath);
const workers = getEngineWorkers(enginePath, workersNb);
return UciEngine.create(engineName, workers);
}