Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add a Open_Spiel Stratego implementation as well adapting MCTSAgent by defining different types of it #146

Merged
merged 62 commits into from
Jul 12, 2021

Conversation

BluemlJ
Copy link
Contributor

@BluemlJ BluemlJ commented Jul 10, 2021

With this pull request, I add an interface to CrazyAra which enables the use of my own Stratego implementation which is based on Open_Spiel. This PR adds two major extensions to CrazyAra:

First the extension of a Stratego environment:

The interface is based on a new state (engine/src/environments/stratego_related/), based on the existing interface for open_spiel games. It also adds my own fork of open_spiel as a submodule because it is not merged with the official open_spiel project yet. (.gitmodules)

To use CrazyAra for Stratego a new game mode called MODE_STRATEGO is added to all necessary files as well as the CMakeList:

  • engine/CMakeLists.txt
  • engine/src/agents/agent.cpp (some improved console output for better understanding Stratego moves)
  • engine/src/nn/tensorrtapi.cpp
  • engine/src/rl/selfplay.cpp
  • engine/src/stateobj.h
  • engine/src/uci/optionsuci.cpp
  • engine/src/uci/variants.h

It is compatible with the Profiling modes as well as the RL mode and is tested with the TensorRT backend.
A building test was also added to the GitHub workflow as well as the possiblity to start the variants workflow out of Github to make testing easier (variants.yml).

The second extension was the addition of MCTSAgent Types. In my thesis, I tested different agent types on imperfect information games. For this, I added new agents which inherit the basic MCTSAgent

  • engine/src/agents/mctsagentbatch, runs multiple mcts agents and combine the results at the end
  • engine/src/agents/randomagent, plays random moves wihtout mcts
  • engine/src/agents/mctsagenttruesight, removes hidden information from imperfect information games to play on a perfect infomation game

I also adapted MCTSAgent for this and added some specific handling for Stratego (like playing starting positions twice with alternating colors). I also added three new modes which are currently only tested on Stratego to run comparisons between different MCTSAgent types and models more easily, directly on the console without using additional software.

  • mctsarena, gets 2 different agent types, the number of matches to play and uses the same model on both agents
  • mctstournament, gets a list of agent types to play a round-robin tournament of n games between all given agents. All agents use the same model.
  • tournament, gets tuples of agen types and models to play a round-robin tournament of n games between all given tuples. The models must be defined in separate folders next to the binary.

I also added a Dockerfile for Stratego which extends the current docker file by installing open_spiel and the dependencies.
(engine/src/rl/Dockerfile_Stratego)

Jannis Blüml added 30 commits July 9, 2021 18:22
…e stratego needs another board - this time correct
…e stratego needs another board - this time correct
engine/src/uci/crazyara.cpp Outdated Show resolved Hide resolved
engine/src/uci/crazyara.cpp Outdated Show resolved Hide resolved
engine/src/uci/crazyara.cpp Outdated Show resolved Hide resolved
Remove static numberofgames from arena modes and add it to the inputstring
engine/src/uci/crazyara.h Outdated Show resolved Hide resolved
engine/src/uci/crazyara.h Outdated Show resolved Hide resolved
Add some comments to the alternative arena methods : mctsarena, mctstournament and evaltournament
engine/src/agents/agent.cpp Outdated Show resolved Hide resolved
Remove the code to print InformationStateTensors as a debugging feature.
engine/src/rl/selfplay.h Outdated Show resolved Hide resolved
QueensGambit and others added 10 commits July 12, 2021 20:38
changed constats to return uint instead of int
reduced scope of bestMoveIdx
removed unused shape
removed unnecessary assignment
removed unused variable fen2
avoid reassigning a value before the old one has been used
pass string by const reference
pass string by const reference
@QueensGambit QueensGambit merged commit 4d768b3 into QueensGambit:master Jul 12, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants