Home

JavaScript Chess Engine: Introduction (Pt.1)

I’ve always enjoyed gaming, and have written my fair share of game bots in the past.

However complicated those bots were, they were never near the difficulty of building a chess engine from scratch. But were they?…

In this series of posts, we are going to tackle that challenge in JavaScript.

The Goal

The goal is simple: to build an engine that can beat its Great Master: me!

Why JavaScript?

Fair question.

Everybody knows that if you are looking for great performance, there are better languages out there.

The primary reason we are going with JavaScript is that we are not looking to build the next Stockfish. I’m not the best of players, and I have a feeling JavaScript may be enough to defeat my sorry a**.

The second reason is learning: as the series progresses we may need to look start looking into secondary threads, processes and some other interesting stuff. It may be instructive to play with those both in NodeJS, as well as in the browser.

The Plan

We are mostly free rolling here, but an initial outline would look something like this:

  1. Intro (this post)
  2. Initial setup & Random Playing Bot
  3. Minimax
  4. Pruned Minimax
  5. Developing an improved static evaluation function
  6. Multi thread/process work
  7. Machine learning assisted evaluation
  8. Defeat the Great Devimal. Make him cry.

It’s worth noting that at first we are going to keep things running in the browser. Later in the series we may explore switching things into a NodeJS backend.

If this the sort of thing interests you, stay tuned. The links to all posts in the series will be visible at the very top of each post.

Peace!