Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
132 views
in Technique[技术] by (71.8m points)

node.js - interact with a console program using javascript

I'm currently making a chess web-based app. Now that I want to add in the stockfish chess engine which I will have to interact with in the command line. I've searched the internet and there's the child_process exe related to Node.js. I know how to use it, but only when it is compiled with Node (for example "node file.js" in the command line) but then i don't know how to call that from my main javascript file which contains the chessboard and stuff. Is there a way to do it (if that's even possible) or you may suggest me another way to do it please :D ?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As you using stockfish - It's not necessary to be CLI version.

Here is a pure JavaScript implementation:

https://www.npmjs.com/package/stockfish


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...