Crates.io | gambit-parser |
lib.rs | gambit-parser |
version | 0.2.0 |
source | src |
created_at | 2022-09-29 20:08:14.813418 |
updated_at | 2023-01-14 03:43:28.079464 |
description | parser for gambit efg files |
homepage | |
repository | https://github.com/erikbrinkman/gambit-parser-rs |
max_upload_size | |
id | 676896 |
size | 78,765 |
A rust parser for gambit extensive form game
(.efg
) files.
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()?;
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.
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.