January 5th, 2005


A Little Hacking

I wrote a chess program today in C++; I'm actually somewhat surprised that you can write such a thing in a single day, but there it is (all 2000 lines of code or so). I haven't really tested it yet, but with the exception of several stalemates (repetition, insufficient material, and taking too long to checkmate a king by its lonesome), all the rules are in there. It's still an idiot, of course, since it can't really compute to a depth necessary to choose a rational opening (so I plan on building it an opening book). And, of course, it's still missing interactive input and output, which makes it difficult to test. And I need to build a wrapper program (most likely in TCL/TK) that will allow it to actually have an opponent, not just a static board position to contemplate.

But it is still, unmistakably, a chess engine.

I plan to tweak the engine somewhat, adding in positional considerations. That will, no doubt, slow down the engine dramatically, but hopefully it will also compensate for the fact that the engine (like all chess engines) can't look terribly deep in a reasonable period of time anyway. Lots of other tweaks will no doubt follow once I've actually got it playing (besides fixing whatever bugs pop up), especially with regards to how it culls its search tree (right now, it doesn't. It doesn't really terminate, either, but given that it's just chewing on one board position -- and so far, that's only been the opening board position -- and reporting back on its progress periodically, that's not exactly an issue yet).
  • Current Music
    They Might Be Giants - Ana Ng