Python


An insanely great language -- the best of lisp combined with 'C' and a little bit of Basic on the side! If you once loved to code but just can't find any enthusiasm for the art any more, try Python . If you can be revived, this will do it and if not, well such is life. My first and so far only endeavor in Python was both a learning project as well as a non-trivial application. What I wanted was a way to display chess games on the internet, formatted with a diagram. As a kind of secondary goal, I also wanted to learn about XML -- mostly to understand all of the hype/info-circus that surrounds it. As you can see, I've been moderately successful!

Every program can be thought of as the solution of a problem, in this case, how do you convert from a standard chess text file to a structured visual presentation on the web? Doesn't take too much thinking to realize that this is a parsing problem where the desired outcome is something along the lines of; regular input plus filter equals regular (transformed) output. The good news here is that all game files to be converted were already in a regular form— Portable Game Notation (text) or Portable Game Notation (html). PGN is a useful tagged based language to describe a chess game and in general is produced as the computer written output of an application that either or allows you to enter moves. Obviously there is no barrier to writing a .PGN file  by hand, after all it is just a text file with a few rules. Usually however, it is easier to use some small program to do this, where things such as move checking and so on are done for you. At any rate, the results are nicely normalized and form reasonable input to a parser.

Before rushing ahead too far, it is time to remember that the first problem definition mentioned the word 'diagram'. This makes a large difference in what the parser needs to do. With this addition, a simple token identifier and classifier is not enough to do the work. To get a diagram, a program must know the current position, it must 'play' the game move by move, from start to finish. So -- functionally, the filter breaks down into three sections:

I'll get around to finishing this article at some point, in the mean time, here is a list of related links:


 Page last touched:
Send e-mail to: hsmyers@gmail.com 


Validated by W3C