Merge branch 'main' of https://gitarero.ecam.fr/guillaume.bonabau/OOP_F1_Project
This commit is contained in:
commit
62567131e3
|
|
@ -5,8 +5,6 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
|
||||
//import for json
|
||||
import org.json.simple.JSONArray;
|
||||
|
|
@ -226,30 +224,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
|
||||
|
|
@ -589,6 +585,12 @@ public class Simulator extends Thread {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//debug print the list of rules
|
||||
public void printRules(ArrayList<Rule> ruleArrayList) {
|
||||
System.out.println("-----------------------------------");
|
||||
|
|
@ -605,6 +607,4 @@ public class Simulator extends Thread {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public class JPanelDraw extends JPanel {
|
|||
private Simulator mySimu;
|
||||
private MyInterface interfaceGlobal;
|
||||
ArrayList<ArrayList<Integer>> colorArrayList;
|
||||
ArrayList<ArrayList<Integer>> colorArrayList;
|
||||
|
||||
public JPanelDraw(MyInterface itf) {
|
||||
super();
|
||||
|
|
@ -71,6 +72,13 @@ public class JPanelDraw extends JPanel {
|
|||
} else {
|
||||
g.setColor(Color.white);
|
||||
}
|
||||
if(cellContent == 2) {
|
||||
g.setColor(Color.yellow); //set collor with rgb value (255,255,0)
|
||||
//g.setColor(new Color(255,255,0));
|
||||
}
|
||||
if(cellContent == 3) {
|
||||
g.setColor(Color.red);
|
||||
}
|
||||
g.fillRect(
|
||||
(int) Math.round(x*cellWidth),
|
||||
(int) Math.round(y*cellHeight),
|
||||
|
|
|
|||
Loading…
Reference in New Issue