-
Notifications
You must be signed in to change notification settings - Fork 48
Sample Random Controller
Raluca D. Gaina edited this page Feb 12, 2018
·
1 revision
This is, as simple as it can get, a completely functional controller for GVG-AI. It just returns a random action to be executed in the next game cycle:
package random; //The package name is the same as the username in the web.
public class Agent extends AbstractPlayer {
protected Random randomGenerator;
//Constructor. It must return in 1 second maximum.
public Agent(StateObservation so, ElapsedCpuTimer elapsedTimer)
{
randomGenerator = new Random();
}
//Act function. Called every game step, it must return an action in 40 ms maximum.
public Types.ACTIONS act(StateObservation stateObs, ElapsedCpuTimer elapsedTimer) {
//Get the available actions in this game.
ArrayList<Types.ACTIONS> actions = stateObs.getAvailableActions();
//Determine an index randomly and get the action to return.
int index = randomGenerator.nextInt(actions.size());
Types.ACTIONS action = actions.get(index);
//Return the action.
return action;
}
}
-
GVG Framework
- Tracks Description
- Code Structure
- Creating Controllers
- Creating Multi Player Controllers
- Creating Level Generators
- Running & Testing Level Generators
- Creating Rule Generators
- Running & Testing Rule Generators
-
Forward Model and State Observation
- Advancing and copying the state
- Advancing and copying the state (2 Player)
- Querying the state of the game
- Querying the state of the game (2 Player)
- Information about the state of the Avatar
- Information about the state of the Avatar (2 Player)
- Information about events happened in the game
- Information about other sprites in the game
- Game Description Class
- Constraints
- Game Analyzer Class
- Level Analyzer Class
- Sprite Level Description Class
- Sprite, Termination, and Interaction Data Class
- Level Mapping Class
- Competition Specifications
- VGDL Language