Building a chess engine with Node

Hello everybody,

I have a crazy idea as I am just a beginner but to keep things exciting. I love chess and I would like to build a chess engine.
So, how would you go about it? Should I take a well known open source one, like Stockfish and reverse engineer it? Or should I just build a simple one that I will try to make strong over time? Both? Reverse a strong one first and build my on after that?

I do not want to make it a project that will be ongoing forever as I think it would be nice in a portfolio, so I need a finished project. So should I just build a simple one and make subsequent versions? The goal is to make it as strong as possible as I am interested in AI and if I manage to get some good results, make it compete against other chess engines.

Do you have any piece of advice?

Thank you for your help!

It looks like you’ll need extensive knowledge of C++ to “reverse engineer” the Stockfish source code.

You could install Stockfish.js in your Node.js app and build on top of it. Then, if you’re really interested in AI, you could make your own simple engine and improve it slowly by comparing its results with the Stockfish version. You could develop automated tests to analyze everything from single moves to match results, identify patterns and differences between patterns. You could display this with charts, graphs, waveforms, etc. (ie, data visualization).

That would look good in your portfolio.

Thanks a lot for the advice. Yes actually about C++ :frowning: It seems like most of the engines are built in C++. I did not think about the data visualization part but it is a nice suggestion.

I also found that: if it is of any interest for someone here.

Actually, Golang would probably be a better choice than Node due to speed but it is possible to get something good with Node.

Yes, I don’t think JS is the best language for complex, deep, long calculations like that. A very simple chess engine maybe, but if you’re trying to build something that can beat real players, then JS just isn’t the right tool. You could always build the backend in Node and call out to code in other languages to handle the number crunching. I think C would be the fastest, with the exception of assembly, natch.

1 Like