jadex.quickstart.cleanerworld.SimpleCleanerAgent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-quickstart Show documentation
Show all versions of jadex-applications-quickstart Show documentation
The Jadex quickstart package contains the ready to use "Cleanerworld" environment as a testbed for experimenting with autonomous agents and intelligent behavior.
package jadex.quickstart.cleanerworld;
import jadex.bridge.service.annotation.OnStart;
import jadex.micro.annotation.Agent;
import jadex.quickstart.cleanerworld.environment.SensorActuator;
import jadex.quickstart.cleanerworld.gui.SensorGui;
/**
* Simple cleaner with a main loop for moving randomly.
*/
@Agent
public class SimpleCleanerAgent
{
//-------- simple example behavior --------
/**
* The body is executed when the agent is started.
*/
@OnStart
private void exampleBehavior()
{
// Create the sensor/actuator interface object.
SensorActuator actsense = new SensorActuator();
// Open a window showing the agent's perceptions
new SensorGui(actsense).setVisible(true);
// Agent uses one main loop for its random move behavior
while(true)
{
actsense.moveTo(Math.random(), Math.random());
}
}
}