Gambit Parser
A rust parser for gambit extensive form game
(.efg) files.
Usage
use ExtensiveFormGame;
use File;
use Read;
let mut buffer = Stringnew;
open?.read_to_string?;
let parsed: = buffer.as_str.try_into?;
Remarks
Gambit's reader duplicates runs of backslashes when reading a quoted label; this parser does not reproduce that bug.
Chance-node probabilities are kept as written and are not required to sum to
one, matching Gambit (which performs no such check). A file that approximates a
distribution with rounded decimals — e.g. 0.333333 repeated three times,
summing to 0.999999 — parses fine; normalize the probabilities yourself if you
need an exact distribution.
To Do
Ultimately this represents a data model that could be modified and serialized,
but that's not implemented yet. The current version keeps a reference to the
underlying file bytes, to implement a full data model there should be an owned
version of the ExtensiveFormGame that supports full serialization and
modification.