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

Provide API for using UCI chess engines

Open lawlesscreation opened this issue 9 years ago • 9 comments

Hi,

I'm wondering if node-chess can be used to carry out board/game analysis, similar to Stockfish JS, where you could give a fen string or board position and node-chess analyses and scores the board in favour of white or black. Similar to http://forwardcoding.com/projects/ajaxchess/chess.html.

It looks like node-chess has a configurable analysis engine with depth and time options but I cannot see any documentation or examples of how this analysis messaging can be displayed to the user.

Thanks for any help.

lawlesscreation avatar Apr 28 '16 09:04 lawlesscreation

I've basically decided that an analysis engine for this would be too difficult at the moment.
However it wouldn't be too laborious to provide an API for attaching a UCI engine. Something like:

import * as stockfish from "stockfish";
const game = chess.classic.engine();
const analyzer = new stockfish();
game.analyzer(analyzer.postMessage);

analyzer.onmessage = event => { /* stuff ... */ }

game.analyze({ /* options ... */ });

If you're happy with that, I can work on that this week.

Seikho avatar Apr 28 '16 10:04 Seikho

Thanks for the response Seikho. That could be a neat feature but we were looking for something that had the analysis engine already. Sadly Stockfish (and therefore Stockfish JS) is GPL licensed which means we cannot use it this time :(

lawlesscreation avatar Apr 28 '16 10:04 lawlesscreation

No problem. I used stockfish as an example. The API would take any UCI chess engine.

Seikho avatar Apr 28 '16 10:04 Seikho

You wouldn't happen to know of any UCI chess engines written in JavaScript or emscripten port? We've not been able to find any other than Stockfish JS.

lawlesscreation avatar Apr 28 '16 12:04 lawlesscreation

The engine you linked should be using UCI. Does that have a compatible license?

Seikho avatar Apr 28 '16 12:04 Seikho

Are you able to use GPLv3?

Seikho avatar Apr 28 '16 12:04 Seikho

Garbochess-JS has a BSD license which is great but it doesn't look like it has changed since 2012 and had limited documentation.

Sadly we cannot using GPLv3 because we cannot open-source our code, at least in the short-term.

lawlesscreation avatar Apr 28 '16 12:04 lawlesscreation

The documentation definitely is poor, but seems to have the same API as stockfish. Apparently it has a playing strength of ~2600 ELO as well.

Seikho avatar Apr 28 '16 12:04 Seikho

Thanks for you're help Seikho. I think we'll give that a shot until we can open-source our code and use Stockfish :)

lawlesscreation avatar Apr 28 '16 12:04 lawlesscreation