Renamed sample_agent to victim
This commit is contained in:
parent
b80ac9a5fa
commit
4a2efe3bb3
7 changed files with 12 additions and 6 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -14,5 +14,5 @@ MAS airSeaRescue {
|
||||||
|
|
||||||
environment: operator.WorldEnvironment(1,500,yes)
|
environment: operator.WorldEnvironment(1,500,yes)
|
||||||
|
|
||||||
agents: sample_agent#4;
|
agents: victim#4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package operator;
|
package operator;
|
||||||
|
|
||||||
import jason.asSyntax.Literal;
|
import jason.asSyntax.Literal;
|
||||||
|
import jason.asSyntax.NumberTerm;
|
||||||
import jason.asSyntax.Structure;
|
import jason.asSyntax.Structure;
|
||||||
import jason.asSyntax.Term;
|
import jason.asSyntax.Term;
|
||||||
import jason.environment.Environment;
|
import jason.environment.Environment;
|
||||||
|
@ -55,10 +56,10 @@ public class WorldEnvironment extends Environment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAgetPos(int i) {
|
private void updateAgetPos(int i) {
|
||||||
clearPercepts("sample_agent"+(i+1));
|
clearPercepts("victom" + (i + 1));
|
||||||
|
|
||||||
Location l = model.getAgPos(i);
|
Location l = model.getAgPos(i);
|
||||||
addPercept("sample_agent"+(i+1), Literal.parseLiteral("pos(" + l.x + "," + l.y + ")"));
|
addPercept("victim" + (i + 1), Literal.parseLiteral("pos(" + l.x + "," + l.y + ")"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,6 +89,12 @@ public class WorldEnvironment extends Environment {
|
||||||
result = model.move(Move.LEFT, agId);
|
result = model.move(Move.LEFT, agId);
|
||||||
} else if (action.equals(skip)) {
|
} else if (action.equals(skip)) {
|
||||||
result = true;
|
result = true;
|
||||||
|
} else if (action.getFunctor().equals("decLife")) {
|
||||||
|
int life = (int)((NumberTerm)action.getTerm(0)).solve();
|
||||||
|
System.out.println(life);
|
||||||
|
result = true;
|
||||||
|
//removePercept(ag,Literal.parseLiteral("life("+life+")"));
|
||||||
|
// addPercept(ag,Literal.parseLiteral("life("+(life-1)+")"));
|
||||||
} else {
|
} else {
|
||||||
logger.info("executing: " + action + ", but not implemented!");
|
logger.info("executing: " + action + ", but not implemented!");
|
||||||
}
|
}
|
||||||
|
@ -102,7 +109,7 @@ public class WorldEnvironment extends Environment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getAgIdBasedOnName(String agName) {
|
private int getAgIdBasedOnName(String agName) {
|
||||||
return (Integer.parseInt(agName.substring(agName.length() - 1)) -1);
|
return (Integer.parseInt(agName.substring(agName.length() - 1)) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSleep(int value) {
|
public void setSleep(int value) {
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class WorldView extends GridWorldView {
|
||||||
/*if (((WorldModel)model).isCarryingGold(id)) {
|
/*if (((WorldModel)model).isCarryingGold(id)) {
|
||||||
super.drawAgent(g, x, y, Color.yellow, -1);
|
super.drawAgent(g, x, y, Color.yellow, -1);
|
||||||
} else {*/
|
} else {*/
|
||||||
super.drawAgent(g, x, y, c, -1);
|
super.drawAgent(g, x, y, Color.GREEN, -1);
|
||||||
idColor = Color.white;
|
idColor = Color.white;
|
||||||
//}
|
//}
|
||||||
g.setColor(idColor);
|
g.setColor(idColor);
|
||||||
|
|
|
@ -17,4 +17,3 @@ life(500).
|
||||||
victim.get_direction(AgX, AgY, D);
|
victim.get_direction(AgX, AgY, D);
|
||||||
do(D);
|
do(D);
|
||||||
-+free.
|
-+free.
|
||||||
|
|
Loading…
Reference in a new issue