optimized code for agents
This commit is contained in:
parent
68ff872248
commit
d591e83bca
|
|
@ -225,30 +225,28 @@ public class Simulator extends Thread {
|
|||
if (agents.get(i).getX() == x && agents.get(i).getY() == y ){
|
||||
agents.remove(i);
|
||||
System.out.println("Corresponding agent found, proceeding with removal");
|
||||
System.out.println(agents.size());
|
||||
removal = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
if(i==agents.size() && removal ==false){
|
||||
//if we find no corresponding agent after the for loop, we add one
|
||||
System.out.println("no agents to remove, proceeding with creation");
|
||||
setSheep(x, y);
|
||||
if (enableLogs) {
|
||||
System.out.println("clickAgent Called, Agent created at: " + x + "," + y + "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
System.out.println("1st iteration");
|
||||
|
||||
setSheep(x,y);
|
||||
}
|
||||
if (enableLogs) {
|
||||
System.out.println("clickAgent Called, Agent created at: " + x + "," + y + "");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//TODO-INPROGRESS : set agent (x y agent) load an agent to coordinates x,y
|
||||
|
|
|
|||
Loading…
Reference in New Issue