node-uci icon indicating copy to clipboard operation
node-uci copied to clipboard

"go" function never returns when passed "searchmoves" option

Open chrisbibat opened this issue 1 year ago • 1 comments

Hello, I have been trying to use the "go" function with various options, and whenever I pass the "searchmoves" option, the function never returns.

I have been trying to get the "searchmoves" option to work with the example code:

import { Engine } from "node-uci"

// async/await
const engine = new Engine("C:/Program Files/Stockfish/stockfish-windows-x86-64-avx2/stockfish/stockfish-windows-x86-64-avx2.exe")
await engine.init()
await engine.isready()
await engine.position("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")
//console.log('engine ready', engine.id, engine.options)
const result = await engine.go({ depth: 3/*, searchmoves: ["e2e4"]*/ })
console.log("result", result)
await engine.quit()

In the above code, the "searchmoves" options is commented out, and the program prints the results as expected. When I uncomment the "searchmoves" option, the function does not return.

I am passing the "searchmoves" option as an array of strings, as I have read in the documentation. I am using Windows 11, and nodemon, if that info helps.

chrisbibat avatar Jun 19 '24 02:06 chrisbibat

Hi @chrisbibat , thanks for opening this issue.

I won't have time to investigate this for a little longer unfortunately, but can you take a look at the debug logs if you get a chance? You can do that by supplying the DEBUG=uci env var before executing your script, as the library uses the https://github.com/debug-js/debug package.

That might shed light into what is being sent to the engine and what the engine sends back, and can help diagnose why the function never returns.

Let me know if you find anything. Otherwise I'll take a look at this when I get some time.

ebemunk avatar Aug 27 '24 03:08 ebemunk