Package net.royalur.agent
Class RandomAgent
java.lang.Object
net.royalur.agent.BaseAgent
net.royalur.agent.RandomAgent
- All Implemented Interfaces:
Agent
An agent that makes random moves in games. This is not thread-safe.
-
Constructor Summary
ConstructorDescriptionInstantiates a random agent using a default source of randomness.RandomAgent
(Random random) Instantiates a random agent that usesrandom
as its source of randomness. -
Method Summary
Modifier and TypeMethodDescriptiondecideMove
(Game game, List<Move> moves) Determines the move to be executed from the current state of the game.
-
Constructor Details
-
RandomAgent
Instantiates a random agent that usesrandom
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
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.
-