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.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
//import for json
|
//import for json
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
|
|
@ -226,29 +224,27 @@ public class Simulator extends Thread {
|
||||||
if (agents.get(i).getX() == x && agents.get(i).getY() == y ){
|
if (agents.get(i).getX() == x && agents.get(i).getY() == y ){
|
||||||
agents.remove(i);
|
agents.remove(i);
|
||||||
System.out.println("Corresponding agent found, proceeding with removal");
|
System.out.println("Corresponding agent found, proceeding with removal");
|
||||||
System.out.println(agents.size());
|
|
||||||
removal = true;
|
removal = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if(i==agents.size() && removal ==false){
|
if(i==agents.size() && removal ==false){
|
||||||
//if we find no corresponding agent after the for loop, we add one
|
//if we find no corresponding agent after the for loop, we add one
|
||||||
System.out.println("no agents to remove, proceeding with creation");
|
System.out.println("no agents to remove, proceeding with creation");
|
||||||
setSheep(x, y);
|
setSheep(x, y);
|
||||||
|
if (enableLogs) {
|
||||||
|
System.out.println("clickAgent Called, Agent created at: " + x + "," + y + "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
System.out.println("1st iteration");
|
|
||||||
|
|
||||||
setSheep(x,y);
|
setSheep(x,y);
|
||||||
|
if (enableLogs) {
|
||||||
|
System.out.println("clickAgent Called, Agent created at: " + x + "," + y + "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (enableLogs) {
|
|
||||||
System.out.println("clickAgent Called, Agent created at: " + x + "," + y + "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -589,6 +585,12 @@ public class Simulator extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//debug print the list of rules
|
//debug print the list of rules
|
||||||
public void printRules(ArrayList<Rule> ruleArrayList) {
|
public void printRules(ArrayList<Rule> ruleArrayList) {
|
||||||
System.out.println("-----------------------------------");
|
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 Simulator mySimu;
|
||||||
private MyInterface interfaceGlobal;
|
private MyInterface interfaceGlobal;
|
||||||
ArrayList<ArrayList<Integer>> colorArrayList;
|
ArrayList<ArrayList<Integer>> colorArrayList;
|
||||||
|
ArrayList<ArrayList<Integer>> colorArrayList;
|
||||||
|
|
||||||
public JPanelDraw(MyInterface itf) {
|
public JPanelDraw(MyInterface itf) {
|
||||||
super();
|
super();
|
||||||
|
|
@ -71,6 +72,13 @@ public class JPanelDraw extends JPanel {
|
||||||
} else {
|
} else {
|
||||||
g.setColor(Color.white);
|
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(
|
g.fillRect(
|
||||||
(int) Math.round(x*cellWidth),
|
(int) Math.round(x*cellWidth),
|
||||||
(int) Math.round(y*cellHeight),
|
(int) Math.round(y*cellHeight),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue