2 unstable releases
0.2.0 | Jan 14, 2023 |
---|---|
0.1.0 | Sep 29, 2022 |
23 downloads per month
Used in cfr
52KB
1.5K
SLoC
Gambit Parser
A rust parser for gambit extensive form game
(.efg
) files.
Usage
use gambit_parser::ExtensiveFormGame;
use std::fs::File;
use std::io::Read;
let mut buffer = String::new();
File::open("my path")?.read_to_string(&mut buffer)?;
let parsed: ExtensiveFormGame<'_> = original.as_str().try_into()?;
Remarks
The gambit spec says that the list of actions in chance and player nodes is technically optional. For this to be optional, they would need to be defined for the same infoset in the same file. Handling this case is slightly more difficult and not well documented. Since I couldn't find any examples of a file like this, this specific omission isn't handled.
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.
Dependencies
~1.5MB
~28K SLoC