
jadex.bdi.puzzle.SokratesMLRAgent Maven / Gradle / Ivy
The newest version!
package jadex.bdi.puzzle;
import java.util.ArrayList;
import java.util.List;
import javax.swing.SwingUtilities;
import jadex.bdi.annotation.Belief;
import jadex.bdi.annotation.Body;
import jadex.bdi.annotation.Goal;
import jadex.bdi.annotation.GoalAPLBuild;
import jadex.bdi.annotation.GoalResult;
import jadex.bdi.annotation.GoalSelectCandidate;
import jadex.bdi.annotation.GoalTargetCondition;
import jadex.bdi.annotation.Plan;
import jadex.bdi.annotation.Plans;
import jadex.bdi.annotation.Trigger;
import jadex.bdi.runtime.IBDIAgent;
import jadex.bdi.runtime.IBDIAgentFeature;
import jadex.bdi.runtime.impl.ICandidateInfo;
import jadex.core.IComponent;
import jadex.execution.IExecutionFeature;
import jadex.micro.annotation.Agent;
import jadex.model.annotation.OnStart;
/**
Puzzling agent.
This agent that plays a board game for one player.
This example is a Jadex adaption of the original JACK(TM)
puzzle example and was used for performance comparisons
between both platforms (cf. readme.txt).
This version shows how the puzzle works
with a graphical board and uses a delay
between the moves. Measurements were done
with the Benchmark.agent in this package.
*/
@Agent(type="bdip")
@Plans({
@Plan(trigger=@Trigger(goals = SokratesMLRAgent.ChooseMoveGoal.class), body = @Body(ChooseMovePlan.class)),
// TODO: binding options for pojo plans?
@Plan(body = @Body(MovePlan.class))})
public class SokratesMLRAgent
{
@Belief
IBoard board = new Board(5);
int triescnt;
long delay = 500;
Strategy ml = Strategy.SAME_LONG;
@Agent
IComponent agent;
enum Strategy
{
NONE, SHORT, LONG, SAME_LONG, ALTER_LONG;
}
@Goal
class MakeMoveGoal
{
int depth;
MakeMoveGoal(int depth)
{
this.depth = depth;
}
@GoalTargetCondition
boolean isSolution()
{
return board.isSolution();
}
@GoalAPLBuild
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy