Both C++ and Python implementation of games necessary for some algorithms? #975
-
Hello all open_spiel developers Thank you very much for releasing this wonderful project! I am just new to RL and open_spiel in general and have some questions that might sound easy for you: Now I want to test the "real" RL algorithms, as DQN, A2C and EVA. Unfortunately, I have found examples for using these algorithms only in the python directory of open_spiel. Anyways, this is a cool framework, thanks again. Best Regards |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello, games written in C++ are exposed to Python via Pybind11, so they can be used from Python without having to reimplement them. This is documented here: It's also possible to add additional methods to a specific game, see https://github.com/deepmind/open_spiel/blob/master/open_spiel/python/pybind11/games_chess.cc for one example of additional methods on a game, which is called in https://github.com/deepmind/open_spiel/blob/master/open_spiel/python/pybind11/pyspiel.cc |
Beta Was this translation helpful? Give feedback.
-
Sorry for the very late reply, I don't normally check this discussion area and there are no notification or anything int the main UI to indicate new ones. :( What JB said is perfect (you only need to implement it once). The game gets "registered" into OpenSpiel so that You can test loading your game from python using this example: https://github.com/deepmind/open_spiel/blob/master/open_spiel/python/examples/example.py (which echoes the same example in C++). |
Beta Was this translation helpful? Give feedback.
Hello,
games written in C++ are exposed to Python via Pybind11, so they can be used from Python without having to reimplement them.
This is documented here:
It's also possible to add additional methods to a specific game, see https://github.com/deepmind/open_spiel/blob/master/open_spiel/python/pybind11/games_chess.cc for one example of additional methods on a game, which is called in https://github.com/deepmind/open_spiel/blob/master/open_spiel/python/pybind11/pyspiel.cc