
jadex.bdi.examples.marsworld_classic.movement.FindTargetsPlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-bdi Show documentation
Show all versions of jadex-applications-bdi Show documentation
The Jadex BDI applications package contain
several example applications, benchmarks and
testcases using BDI agents.
The newest version!
package jadex.bdi.examples.marsworld_classic.movement;
import jadex.bdi.examples.marsworld_classic.Environment;
import jadex.bdi.examples.marsworld_classic.Location;
import jadex.bdi.examples.marsworld_classic.Target;
import jadex.bdi.runtime.Plan;
/**
* Look if a target is near to my position.
*/
public class FindTargetsPlan extends Plan
{
//-------- constructors --------
/**
* Create a new plan.
*/
public FindTargetsPlan()
{
getLogger().info("Created: "+this);
}
//-------- methods --------
/**
* The plan body.
*/
public void body()
{
while(true)
{
Environment env = (Environment)getBeliefbase().getBelief("environment").getFact();
Location myloc = (Location)getBeliefbase().getBelief("my_location").getFact();
Double myvis = (Double)getBeliefbase().getBelief("my_vision").getFact();
Target[] ts = env.getTargetsNear(myloc, myvis.doubleValue());
//if(ts.length>0)
// System.out.println("Sees: "+SUtil.arrayToString(ts));
for(int i=0; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy