package jadex.bdi.examples.marsworld_classic.movement; import jadex.bdi.examples.marsworld_classic.Location; import jadex.bdi.runtime.IGoal; import jadex.bdi.runtime.Plan; /** * Wander around randomly. */ public class RandomWalkPlan extends Plan { //-------- constructors -------- /** * Create a new plan. */ public RandomWalkPlan() { //getLogger().info("Created: "+this+" for goal "+getRootGoal()); } //-------- methods -------- /** * The plan body. */ public void body() { double x_dest = Math.random(); double y_dest = Math.random(); Location dest = new Location(x_dest, y_dest); IGoal moveto = createGoal("move_dest"); moveto.getParameter("destination").setValue(dest); dispatchSubgoalAndWait(moveto); getLogger().info("Reached point: "+dest); } }