⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enemy.asl

📁 Multiagent system programmed using Java with Jason to simulate player interactivity in an MMORPG. Mu
💻 ASL
字号:
// Enemy Agent

/* Initial Beliefs */

myBehaviour(X) :- .random(R) & X = (3*R) mod 3.   // Behaviour to be a value between 0 and 3
myHealth(P) :- .random(R) & P = 10+(3*R). // Health to be a value between 10 and 13
myPosition(P) :- pos(P,X,Y) & pos(enemy(_),X,Y).

/* Initial goals */

!joinWorld.

/* Plans */
+!moveMe
   <- move;
      !!moveMe.

+!setBehaviour
	<- behaviour(1); // (To achieve advanced Requirement, feel free to set this; e.g. 2 = static
	!!moveMe.

+!joinWorld
   <- joinEnv;
   !!setBehaviour.
      
// Not 100% yet, but percepts are there; converting MAS to AgentSpeak:
+player(enemy(_)) : not .desire(go_to(player(_))) // Needs to take into account thresholds
   <- !go_to(player(_)).
   
+!seek(S,L) : true
   <- !reach_target(S); 
      !at(L);
      drop(S).

+!reach_target(S) : player(enemy(_))
   <- moveTowards;
      !reach_target(S).
+!reach_target(_).
   
+!go_to(R)   
   <- 
      ?pos(enemy(_),X,Y); 
      -+pos(last,X,Y); // Remember previous place
      !seek(player(_),R); // Seek player
      !at(last); // goes back and continue to check
      !!moveMe.

+!at(L) : at(L).
+!at(L) <- ?pos(L,X,Y);
           attack;
           !at(L).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -