DeepMind开源的OpenSpiel对棋牌类的强化学习有非常大的学习价值,而且游戏和算法都给出了相应的参考网站和论文,真的是一个研究学习的好资源。
-
为了便于学习,增加c++代码调试信息,可以使用vs code等ide动态调试代码,便于对一些疑惑的代码进行跟踪。
修改open_spiel/open_spiel/CMakeLists.txt
set (CMAKE_CXX_FLAGS “-Werror”) 修改为
set (CMAKE_CXX_FLAGS “-g -Werror”)
生成的example或测试代码都是可以设置断点,单步跟踪等方式动态分析程序。 -
hanabi游戏是新增的imperfect game,默认没有编译,需要修改一些配置。
// 1. git clone the Hanabi Learning Environment above (e.g. in $HOME)
cd $HOME
git clone https://github.com/deepmind/hanabi-learning-environment
// 2. Set the path of HANABI_HOME in games/hanabi/CMakeLists.txt
如果clone到home目录,则不需要修改,否则修改为实际clone的目录。
// 3. Uncomment hanabi.cc, hanabi.h, and the add_subdirectory (hanabi) in
// games/CMakeLists.txt
// 4. Uncomment the $<TARGET_OBJECTS:hanabi_learning_environment> in the
// top-level CMakeLists.txt -
再参考 安装说明 https://github.com/deepmind/open_spiel/blob/master/docs/install.md 即可编译生成可运行(测试)的代码。
因为修改了编译配置,增加了hanabi的支持,测试代码也需要修改。
open_spiel/open_spiel/python/…/python/tests/pyspiel_test.py", line 77, in test_registered_names
self.assertCountEqual(game_names, expected)
AssertionError: Element counts were not equal:
在 "havannah"之前增加"hanabi"即可测试100%通过。
“goofspiel”,
“hanabi”,
“havannah”,