I’m starting my second Chess project, and one effect of that is that I’ve compiled a list of helpful resources for anyone trying to create a chess application. They’re in two sections — one for building a chess AI, and one for building a usable chess board.
Chess AI Resources
These are helpful for creating a computer chess player. Depending on what you’re trying to do, this could be the most or least important aspect of your project.
Chess Programming Wiki
The chess programming wiki is a great learning resource. Not only does it have pages on all the key concepts, it does a great job at compiling sources on each topic — print publications, old software forum posts, all kinds of things. If you want to build a chess AI, you should probably use this site as a tutorial.
Raymond Tran’s Blog Post
Raymond Tran is, I gather, a teenager at MIT who has not yet taken the course where you build a chess engine. Nonetheless he made a very cool chess site with some unique, impressive features (more on that later). In this MIT blog post he goes over some of the key concepts, and provides code snippets for you to follow along. It’s mostly a reorganization of chessprogramming.org information into a single introductory lesson.
Stockfish
Stockfish is the strongest chess engine that exists, and it’s open source. You can look at it! The latest release has started integrating some neural-network elements, but before that, it was really just a highly optimized version of the simple little elements Tran taught us about above.
Leela Chess Zero
Lc0 is the second-strongest chess engine, an open-source fork of Google’s AlphaZero project. Since it’s all neural network, no preprogrammed chess knowledge, there’s not much you can get out of looking at it. But it is there.
Chessboard Code Repositories
These are public repos where you can go in and see an entire actual implementation. There are many, many more than what I’ve listed here, but these are the ones I’ve found helpful to look at so far. Because of my own needs, there is a bias towards both React and chess variants.
chess.js and chessboard.js
These two Javascript libraries are the gold standard for web chess. These are what you should be using in almost every case. Both lichess and chess.com, by far the two largest chess sites, use them both. They’re the backbone of chess on the internet. The only reason my list is longer than these two is that I wanted to do things with fairy (non-standard) pieces, which is something they don’t really have any room for. Still, I’d default to aping them in all ways I can.
chessboard.js (the UI elements, i.e. the board and pieces) on github
chess.js (the rules engine) on github
yagu0’s vchess
vchess (variant chess) is a live website, though not one with any activity as far as I can tell. However, you can view the code on github here. vchess supports a variety of different rules, boards and fairy pieces, which makes it pretty notable.
raytran’s protochess
Remember the Chess AI blog post from above? This is the author’s project. Like vchess, it’s a live site for playing with variants. It’s a bit more customization-minded than vchess, with the ability to define your own fairy pieces, change the board size on the fly, and even put in walls. This is something I always wanted to make myself, frankly.
You can look through the github repo here.
rexxar’s react-chess
This is a package available through npm (Node Packet Manager). It’s just a board with draggable pieces, no rules enforcement or anything like that — basically a start at making chessboard.js in React. It’s here on github.
TalhaAwan’s react-chess
Like above, this is an npm package. It has a greater degree of rules enforcement —alternating turns and legal movement — though it doesn’t know that there’s anything special about the king. This one doesn’t allow dragging of pieces.
It’s on github here, and it comes with a tutorial blog post here.
lichess
lichess is the second-largest and first-best chess site. It’s completely open source (and free, and ad-free), meaning you can look at the whole thing, the whole site, all forty thousand commits’ worth. And if you spend some time getting into the weeds, you can even work on it — a most noble calling. It’s written in Scala.
Apple Chess
For nearly twenty years, Apple has included a chess game with your Macs. It’s partially open source, and they publish the whole thing. Like lichess, this is a full, complete, in-production application.