20 lines
467 B
Text
20 lines
467 B
Text
// Agent sample_agent in project airSeaRescue
|
|
|
|
/* Initial beliefs and rules */
|
|
free.
|
|
life(500).
|
|
|
|
/* Initial goals */
|
|
+gsize(_,_) : true
|
|
<- !send_init_pos.
|
|
+!send_init_pos : pos(X,Y)
|
|
<- .print("Position initialised").
|
|
+!send_init_pos : not pos(_,_) // if I do not know my position yet
|
|
<- .wait("+pos(X,Y)", 500); // wait for it and try again
|
|
!!send_init_pos(S).
|
|
+free : pos(AgX,AgY) & life > 0
|
|
<-
|
|
victim.get_direction(AgX, AgY, D);
|
|
do(D);
|
|
-+free.
|
|
|