Update sympa

This commit is contained in:
Balthazar SQUINABOL 2024-04-29 16:27:43 +02:00
parent 9c325932f5
commit ca19544980
3 changed files with 8 additions and 7 deletions

View File

@ -7,8 +7,8 @@ public class Simulator extends Thread {
private MyInterface mjf;
private final int COL_NUM = 10;
private final int LINE_NUM = 10;
private final int COL_NUM = 100;
private final int LINE_NUM = 100;
private final int LIFE_TYPE_NUM = 4;
//Conway Radius : 1
private final int LIFE_AREA_RADIUS = 1;
@ -39,7 +39,6 @@ public class Simulator extends Thread {
pauseFlag=false;
loopingBorder=false;
clickActionFlag=false;
cellDensityToggle=true;
agents = new ArrayList<Agent>();
fieldBirthValues = new ArrayList<Integer>();
@ -51,6 +50,8 @@ public class Simulator extends Thread {
this.height=LINE_NUM;
enableLogs = true; // for debugging purposes
table = new Table(height, width, this);
cellDensityToggle=false;
//Default rule : Survive always, birth never
@ -304,6 +305,7 @@ public class Simulator extends Thread {
* @param lines of file representing saved world state
*/
public void loadSaveState(ArrayList<String> lines) {
System.out.println("loadSaveState called");
/*
* First some checks that the file is usable
* We call early returns in conditions like this
@ -324,8 +326,11 @@ public class Simulator extends Thread {
*/
for(int y =0; y<lines.size();y++) {
String line = lines.get(y);
System.out.println("line : " + line);
String[] lineElements = line.split(";");
for(int x=0; x<lineElements.length;x++) {
System.out.println("x : " + x);
System.out.println("lineElements : " + lineElements[x]);
String elem = lineElements[x];
int value = Integer.parseInt(elem);
setCell(x, y, value);

View File

@ -93,9 +93,6 @@ public class Table {
System.out.println("Created a random field");
}
//TODO : load(filepath) turn a loaded saveable file into a table
//TODO : save(filename) turn the table into saveable file
public void serialPrint(){
for (int i = 0; i < height; i++) {
System.out.print("\n");

View File

@ -35,7 +35,6 @@ public class JPanelDraw extends JPanel {
});
}
public void setSimu(Simulator simu) {
mySimu = simu;
}