Implemented AI Players

Implemented AI Players

The implemented agents can be found under the players/ directory. To use them select one of the available games and add the agents to the list of players. See example in PandemicGame.

Some agents (i.e: OSLA and MCTS) use a forward model to simulate actions. The forward model is automatically assigned by the game to the agents and is accessed by calling player.getForwardModel(). To advance a game state with an action you can call forwardModel.next(gameState, action), which modifies the gameState reference directly.

Human console player

The Human console player allows the player to play using the console. The game state and the available actions are printed in the console and the player has to return the index of the action it chooses to play.

agents.add(new HumanConsolePlayer());

Human GUI player

As the name suggests, the Human GUI player allows the player to play the game with a Graphical User Interface. The presented GUI is game specific, so they differ from game to game. To use it, we have to add an ActionController first and then use it in the HumanGUIPLayer’s constructor. The ActionController allows the player to interact with the GUI.

ActionController ac = new ActionController();
players.add(new HumanGUIPlayer(ac));

Random player

Randomly returns one of the possible actions from the list of available actions.

To use a random player in a game, just simply add the agent to the list of players.

players.add(new RandomPlayer(new Random()));

One Step Look Ahead

From the current state evaluates all the possible actions and picks the action which leads to the highest valued state. To add a new OSLA player, just use the following line. There is another constructor for OSLA, which takes an argument of type Random. This can be used to seed the agent and make the runs reproducible.

players.add(new OSLA());

For more general info about the algorithm we refer the reader to

Browne, Cameron B., et al. ‘A Survey of Monte Carlo Tree Search Methods’. IEEE Transactions on Computational Intelligence and AI in Games, vol. 4, no. 1, Mar. 2012, pp. 1–43. link

Usage:

players.add(new MCTSPlayer(seed));

players.add(new MCTSPlayer(new MCTSParams()));

The default constructor takes in the seed of type long. A second constructor is available, which takes in an argument of type MCTSParams. MCTSParams defines the parameters for the algorithm, including the random seed. The full set of parameterisations possible for Monte Carlo Tree Search is documented here.