#parser #gambit #efg


parser for gambit efg files

2 unstable releases

0.2.0 Jan 14, 2023
0.1.0 Sep 29, 2022

#902 in #parser

35 downloads per month
Used in cfr

MIT license

1.5K SLoC

Gambit Parser

crates.io docs license tests

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.

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.


~27K SLoC