During this phase, the tags are decomposed and stored into an internal hash for future use, while the game text is left untouched. The reading will only identify the two components of a game, i.e. Parsing PGN games is actually two actions: reading and parsing. In the current PGN file and return an array of hashes with all the Read_all(), quick_read_all(), smart_read_all() will read all the records
Will call parse_game() or quick_parse_game(), depending on the Smart_parse_game() Best of the above methods. Should be the preferred method when we know that we are Quick_parse_game() Same as the above, but doesn't save the comments, It can deal with nested comments and recursive parse_game() parse the current game, and stores the moves into anĪrray and optionally saves the comments into an array of hashesįor furter usage. While dealing with simple braced comments is straightforward, parsing nested comments can give you more than a headache.Ĭhess::PGN::Parse most immediate methods are: read_game() reads one game, separating the tags and the game text. A string of numbered chess moves, optionally interrupted by braced comments and recursive parenthesized variants and comments. This module offers a clean handle toward reading and parsing complex PGN files.Ī PGN file has several tags, which are key/values pairs at the header of each game, in the format Īfter the header, the game follows. However, dealing with some of the intricacies of the Standard is less than trivial. Parsing simple PGN files is not difficult.
PGN CHESS RESULTS ARCHIVE
Being a public, well established standard, PGN is understood by many chess archive programs. It is among the preferred means of chess games distribution. PGN files contain chess games produced by chess programs following a standard format ().
PGN CHESS RESULTS PORTABLE
My = $pgn->smart_read_all() DESCRIPTIONĬhess::PGN::Parse offers a range of methods to read and manipulate Portable Game Notation files. My $pgn = new Chess::PGN::Parse undef, $text Chess::PGN::Parse - reads and parses PGN (Portable Game Notation) Chess files SYNOPSIS use Chess::PGN::Parse