Class RandomAgent

java.lang.Object
net.royalur.agent.BaseAgent
net.royalur.agent.RandomAgent
All Implemented Interfaces:
Agent

public class RandomAgent extends BaseAgent
An agent that makes random moves in games. This is not thread-safe.
  • Constructor Details

    • RandomAgent

      public RandomAgent(Random random)
      Instantiates a random agent that uses random as its source of randomness.
      Parameters:
      random - The source of randomness to use to decide the moves to make.
    • RandomAgent

      public RandomAgent()
      Instantiates a random agent using a default source of randomness.
  • Method Details

    • decideMove

      public Move decideMove(Game game, List<Move> moves)
      Description copied from interface: Agent
      Determines the move to be executed from the current state of the game.
      Parameters:
      game - The game to find the best move in.
      moves - The list of available moves to be chosen from.
      Returns:
      The move that the agent chose to play.