Back in 2008 I wrote an online chess game. It took me about a month to get it working, and then I gradually fixed bugs and added new features for another 3 months or so. It was online for about three years and I used to play chess there with my dad or friends. Then at some point I had to change my server, and it was a pain to get the server-side dependencies working again so I just dismissed my little service.
This year I've decided to put it back online, so I digged my old hard drives for the sources. As I said, it took like one month to write it -- so productive I was! A quick look at the code explains it, though. The server-side is Perl and it's basically write-only (awful) code. While I probably could sync it with the dependencies and get it back working, the feeling that there are a thousand bugs inside won't let me sleep at night, so I started rewriting the server side in Common Lisp (the client is somewhat OK, I can maintain it).
When you write chess software, even if it's not supposed to play chess but only allow two humans to play
chess together, it must still have some notion about the rules of the game, for example to detect checkmate, or to
prevent someone from making illegal moves. You need to implement a proper move generator even for something “as simple
as” parsing chess moves in algebraic notation --
to read a move like "Ne5"
, which means “kNight moves to e5
”, you must know where on
the board is the knight of the current side that can move to e5
(and it better be only one). There's
similar pain in generating the SAN notation for a move.
For Perl I wrote Chess::Rep back in 2008, and I knew I'd need something like this in Lisp, so I wrote QUEEN. It's the module I'm writing about here. The full game is not ready yet, but QUEEN is useful in itself so I published it and submitted it for inclusion into Quicklisp.
[ read more... ]