A Framework for Reinforcement Learning in Games (forked from OpenSpiel)
Project description
Map Games Proto: A Framework for Reinforcement Learning in Games
Map Games Proto is a fork of OpenSpiel, maintained by LogitGames. This package is available on PyPI as map-games-proto.
OpenSpiel is a collection of environments and algorithms for research in general reinforcement learning and search/planning in games. OpenSpiel supports n-player (single- and multi- agent) zero-sum, cooperative and general-sum, one-shot and sequential, strictly turn-taking and simultaneous-move, perfect and imperfect information games, as well as traditional multiagent environments such as (partially- and fully- observable) grid worlds and social dilemmas. OpenSpiel also includes tools to analyze learning dynamics and other common evaluation metrics. Games are represented as procedural extensive-form games, with some natural extensions. The core API and games are implemented in C++ and exposed to Python. Algorithms and tools are written both in C++ and Python.
Installation
Install from PyPI:
pip install map-games-proto
Note: The package is installed as map-games-proto but imported as open_spiel:
import open_spiel
Index
Please choose among the following options:
- Installing OpenSpiel
- Introduction to OpenSpiel
- API Overview and First Example
- API Reference
- Overview of Implemented Games
- Overview of Implemented Algorithms
- Developer Guide
- Using OpenSpiel as a C++ Library
- Guidelines and Contributing
- Authors
For a longer introduction to the core concepts, formalisms, and terminology, including an overview of the algorithms and some results, please see OpenSpiel: A Framework for Reinforcement Learning in Games.
For an overview of OpenSpiel and example uses of the core API, please check out our tutorials:
- Motivation, Core API, Brief Intro to Replictor Dynamics and Imperfect Information Games by Marc Lanctot. (slides) (colab)
- Motivation, Core API, Implementing CFR and REINFORCE on Kuhn poker, Leduc poker, and Goofspiel by Edward Lockhart. (slides) (colab)
Citation
This project is forked from OpenSpiel. If you use this framework in your research, please cite the original OpenSpiel paper:
@article{LanctotEtAl2019OpenSpiel,
title = {{OpenSpiel}: A Framework for Reinforcement Learning in Games},
author = {Marc Lanctot and Edward Lockhart and Jean-Baptiste Lespiau and
Vinicius Zambaldi and Satyaki Upadhyay and Julien P\'{e}rolat and
Sriram Srinivasan and Finbarr Timbers and Karl Tuyls and
Shayegan Omidshafiei and Daniel Hennes and Dustin Morrill and
Paul Muller and Timo Ewalds and Ryan Faulkner and J\'{a}nos Kram\'{a}r
and Bart De Vylder and Brennan Saeta and James Bradbury and David Ding
and Sebastian Borgeaud and Matthew Lai and Julian Schrittwieser and
Thomas Anthony and Edward Hughes and Ivo Danihelka and Jonah Ryan-Davis},
year = {2019},
eprint = {1908.09453},
archivePrefix = {arXiv},
primaryClass = {cs.LG},
journal = {CoRR},
volume = {abs/1908.09453},
url = {http://arxiv.org/abs/1908.09453},
}
Original Repository
This is a fork of the original OpenSpiel repository by DeepMind.
Versioning
We use Semantic Versioning.
Next
- Make CC analogs of these classes: class DeckStatus(PClass): idx = field(type=int) uuid = field(type=str) faceup_stack = field(type=(FaceupCardStack, type(None)), initial=None) faceup_spread = field(type=(FaceupCardSpread, type(None)), initial=None) facedown_stack = field(type=(FacedownCardStack, type(None)), initial=None) facedown_spread = field(type=(FacedownCardSpread, type(None)), initial=None) discard_faceup_stack = field(type=(FaceupCardStack, type(None)), initial=None) discard_facedown_stack = field(type=(FacedownCardStack, type(None)), initial=None)
The command to run the tests is:
python open_spiel/python/tests/games_interstate_test.py
You can also run specific test methods if you want:
Run just one test
python open_spiel/python/tests/games_interstate_test.py GamesInterstateTest.test_default_parameters
Run with verbose output
python open_spiel/python/tests/games_interstate_test.py --verbose
If you want to run all Python tests in the test suite, you could do:
Run all tests (if you have pytest installed)
pytest open_spiel/python/tests/
Or run all game tests matching a pattern
python -m unittest discover open_spiel/python/tests/ "games_*_test.py"
The test uses absltest which is Google's testing framework, so it can be run directly as a Python script as shown above.
When you encounter a build error like "No rule to make target", follow these steps:
- Try running make games directly from the build directory: cd /Users/jh/Projects/map_games_proto/build make games
- This often resolves stale build state issues.
- If that doesn't work, try a clean rebuild: cd /Users/jh/Projects/map_games_proto/build rm -rf games/CMakeFiles/games.dir/interstate/* make games
- For more serious issues, do a full clean and reconfigure: cd /Users/jh/Projects/map_games_proto/build rm -rf * cmake ../open_spiel make games
- Use the build script from the project root: cd /Users/jh/Projects/map_games_proto ./open_spiel/scripts/build_only.sh interstate
Quick Rebuild and Test Commands:
Single command chain: ./open_spiel/scripts/build_only.sh interstate && pip install -e . --no-build-isolation && python open_spiel/python/tests/games_interstate_test.py
Or broken down:
- Rebuild just the interstate game (fastest C++ build): ./open_spiel/scripts/build_only.sh interstate
- Update Python bindings (development install): pip install -e . --no-build-isolation
- Run the test: python open_spiel/python/tests/games_interstate_test.py
Even Faster (if you're iterating):
After the first build, you can often skip the pip install step if you're only changing C++ implementation (not headers or interfaces):
./open_spiel/scripts/build_only.sh interstate && python open_spiel/python/tests/games_interstate_test.py
This typically takes less than 10 seconds for rebuilding just the interstate game and running the tests!
Most Common Commands
./open_spiel/scripts/build_only.sh interstate ./build/examples/console --game=interstate python open_spiel/python/tests/games_interstate_test.py ./open_spiel/scripts/buildpiptest.sh interstate ./open_spiel/scripts/buildtest.sh interstate
TODO:
- Figure out how to enumerate (or assign action indices) to all the ways that someone can claim a path. Maybe it means discrete actions for selecting resources? There needs to be some 1-n translation of web-site actions to granular game actions.
- Figure out "MaxChanceOutcomes" for InterstateGame.
- Finish implementing "DoApplyAction" for the Faceup Spot Actions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file map_games_proto-1.6.8.8.tar.gz.
File metadata
- Download URL: map_games_proto-1.6.8.8.tar.gz
- Upload date:
- Size: 4.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef2346b5c357fe4d3fea539b8a4c4bd3e26fbf14f65d7d2d471204091c89f07f
|
|
| MD5 |
37288142de69784f741ae4c58f79368c
|
|
| BLAKE2b-256 |
77a5186e450ae236939cf765a501e87b6aada8e03226a728b38337541557cb19
|
File details
Details for the file map_games_proto-1.6.8.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: map_games_proto-1.6.8.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 9.0 MB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37bb377046e3abc311a5b91781054482dbaa83242507bce4f698c0934828daf8
|
|
| MD5 |
dcd918a98ceb9e6ae3b08f537fa1bc74
|
|
| BLAKE2b-256 |
ca3e83af501a6e3526c502863350b512545243a861eafae19d406767e145a14f
|
File details
Details for the file map_games_proto-1.6.8.8-cp310-cp310-macosx_15_0_arm64.whl.
File metadata
- Download URL: map_games_proto-1.6.8.8-cp310-cp310-macosx_15_0_arm64.whl
- Upload date:
- Size: 8.3 MB
- Tags: CPython 3.10, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c77a65eb4c4d68de64c523c4ab78e7c357c650b2bf19c69b6c0ec76dab33aa82
|
|
| MD5 |
502baef653c73c61eee03471d94e2ec5
|
|
| BLAKE2b-256 |
fe0fc12a618df9415505868f814f638b97937e45ec2600c70524d7cfcf0c7fc9
|