PGN-reading code
Posted: 01 Dec 2004, 15:21
Hi all,
I like programming my chess engine, trying to make it better and such, but I dislike some aspects of it. Probably because I'm not well versed in the routines involved... it's (file) parsing.
More specifically, I would like to parse a PGN-file.I already made a function to parse SAN-notation, but I'm stuck with the PGN-file itself. Problems seem to arise when I think about moves going from one line onto the other, hacked in half by a new line. (does that occur?)
So my question is: does anyone have some easy to understand code to read PGN-files? I tried looking at crafty, but I'm really looking for something more 'pedagogical'.
Thanx, Laurens.
I like programming my chess engine, trying to make it better and such, but I dislike some aspects of it. Probably because I'm not well versed in the routines involved... it's (file) parsing.
More specifically, I would like to parse a PGN-file.I already made a function to parse SAN-notation, but I'm stuck with the PGN-file itself. Problems seem to arise when I think about moves going from one line onto the other, hacked in half by a new line. (does that occur?)
So my question is: does anyone have some easy to understand code to read PGN-files? I tried looking at crafty, but I'm really looking for something more 'pedagogical'.
Thanx, Laurens.