Programming a chess AI that can beat me is an item that's been on my bucket list for a long time, believe it or not. Spoiler: I'm terrible at chess, so creating an AI to beat me specifically wasn't too difficult. You can play against the AI from the comfort of your browser here: https://jaredkrinke.github.io/cm-chessboard/ Motivation Similar to static site generators, no one is clamoring for a new chess engine written by me. My primary motivations were to: Experiment with my development environment Keep things as simple as possible Maybe port the result to an old, slow vintage computer I opted to prepare as little as possible--just start coding! Development environment I'm nostalgic for the pre-always-on-Internet days--without constant distractions and bloat. I also just revived an Asus EeeBook X205T netbook. So I settled on revisiting late 90s programming, using GNU Screen, Vim, entr, and w3m, in terminal mode. Typing into the console on a tiny, light netbook is peak "cozy coding". Keeping things simple With an eye toward simplicity, and also portability to old computers, I opted for using C, with as few dependencies as possible. In the end, the core of my chess engine and its associated AI (excluding the front end) have exactly zero dependencies. It uses a fixed amount of memory, with no dynamic allocations! The full chess engine is under 600 lines and the AI is under 150. Compiled to WebAssembly, the whole shebang is under 6 KB. I'd been hoping to run it on my Pentium laptop or Raspberry Pi B, but now I'm wondering if it could run on DOS, or maybe even an Amiga! Not everything went perfectly, however. In an attempt to rush through the project, I put off writing tests until absolutely necessary--hoping they would never be needed. But eventually I needed to refactor and rewrite the trickiest bits of movement code (en passant and castling), and I had to stop and build up a test framework and tests from scratch, in the middle of a rewrite. For the record: the tests u...
First seen: 2026-01-03 21:18
Last seen: 2026-01-04 02:19