This repository contains the code for Leeroy Jenkins, our risk agent for the "Strategy Game Programming" lecture at the TU Wien.
Leeroy is only inteded to play 1 vs 1 risk games, so do not expect good results when employing it with more than two players.
This README contains a brief overview of the core parts of Leeroy Jenkins, for more technical details please check out
the javadoc comments in the code, and for more insights into the project please read docs/in-depth.md
.
This repository contains three separate agents, each extending the one before it.
The basic Leeroy agent employs simple heuristics for most of the actions, except for the initial placement, where Monte Carlo Tree Search is used to try to reach a placement which is favourable for it. The tree of this search is persisted for the full initial reinforcement phase.
The MCTS Leeroy replaces the reinforcement, attack, and occupy heuristics of the basic agent with a seperate Monte Carlo Tree Search, which incorporates all of those three actions. In this agent, the search tree is only used once per search for an action, so after each executed one it is discarded, and a new one is used for the next request.
In the "Leeroy MCTS cached" agent, the search tree for reinforcement, attack, and occupy is persisted during each turn, and only discarded when it is detected that the enemy made a turn after leeroys last action.
There are two ways to run Leeroy, one by using the also supplied GameSimulator
, and the other one by using
the risk sdk
To run a version of Leeroy with an improved reinforcement heuristic, you need to extend the heap space of the jvm to at
least 8GB by invoking java
with -Xmx8g
.
In this codebase, the GameSimulator
class can be used to set up one or more games. It currently contains an example to
run a 10-round competition between the caching MCTS Leeroy and the simple Leeroy, but can be extended with other agents.
If you want to use the Risk SDK to employ a version of the Leeroy agent, generate the jar by running maven package
and
then invoke the SDK
with java -jar lib/sge-1.0.0.jar match --file=lib/sge-risk-1.0.0.jar --file=target/leeroy-fat.jar --file={path to other agent}
Supplied with the code there is a set of additional python tools to process the data generated by the GameSimulator
.
Those can be found in the analysis
directory. To use them, first install the required packages
with pip3 install -r requirements.txt
and, once installed, invoking create_graphs
by running python3 create_graphs.py
.