Posts in June, 2006

A while ago I wrote a chess module for Python. Now this is not a chess-playing module, rather it parses chess moves, stores board positions and works out legal moves. It can also read and write PGN files. I can fairly confidently declare myself as an expert in this kind of thing, having written the PC chess game Chess Commander.

Chess is something that is very well defined, the rules are laid out in black and white, but there are enough juicy problems and gotchas to make it interesting to work on. It was the special case moves such as en passant and castling that were most tricky. I made extensive use of Python's generators extensively which did simplify things a great deal. continue reading…’ is a Python module to encode / decode netstrings. A netstring is a simple protocol for encoding arbitrary strings in a file or datastream. They have the major advantage over the traditional zero terminated strings in that the reader knows the size of the string up front and does not have to examine the data a byte at the time.

There is no documentation for this module other than the docstrings, but hopefuly that should cover it. For more information on the netstring protocol see the official netstring protocol document.