OpenSpiel's export_gambit() in gambit.py only handles payoffs
at terminal nodes via state.returns(). Games with intermediate
(non-terminal) rewards — supported by both OpenSpiel and Gambit's
.efg format — are silently exported incorrectly.
Modified build_tree() to check state.rewards() at chance and
player nodes. Non-zero intermediate rewards are now encoded as
outcome blocks in the .efg output.
OpenSpiel includes a high-performance C++ backend. Because of this, running the Python code requires either a pre-compiled pyspiel wheel or a full C++ build environment. Running this locally depends heavily on your OS and Python version:
This is the smoothest path, as OpenSpiel has extensive support for Linux environments.
- Create a virtual environment with Python 3.9 - 3.11:
python3 -m venv venv - Activate it:
source venv/bin/activate - Install OpenSpiel:
pip install open_spiel - Run the exporter:
import pyspiel from open_spiel.python.algorithms.gambit import export_gambit game = pyspiel.load_game("catch") print(export_gambit(game))
OpenSpiel does NOT publish pre-compiled .whl files for Windows on PyPI. regardless of your Python version.
If you attempt to run pip install open_spiel naively on Windows Command Prompt or PowerShell, pip will forcibly download the raw C++ .tar.gz source and attempt to natively compile compiling over 1GB of C++ code locally.
This will instantly crash unless you have fully installed and configured:
- CMake
- Visual Studio C++ Build Tools (MSVC)
- Clang / LLVM
Workaround for Windows Users: If you want to use OpenSpiel locally on a Windows machine rapidly without an arduous 2-hour native C++ compilation setup, you must use Method 1 (WSL). Alternatively, you can follow the official Windows Native Compilation Guide.
Note: The included gambit_test.py strictly tests the Python logic and will pass flawlessly in any CI environment (like GitHub Actions) where the OpenSpiel C++ backend is properly built.
https://www.gambit-project.org/gsoc_2026/#idea-8
This is a pre-GSoC proof-of-concept. A full PR to OpenSpiel will include tests, NFG exporter fixes, and documentation.