This commit is contained in:
Balthazar SQUINABOL 2024-04-25 10:38:03 +02:00
parent f2bcfcda14
commit ae639fe737
2 changed files with 31 additions and 2 deletions

View File

@ -12,13 +12,17 @@ public class Cell {
public int getValue() { public int getValue() {
return value; return value;
} }
public int getDensity() { public int getDensity() {
return density; return density;
} }
public void setValue(int value) { public void setValue(int value) {
this.value = value; this.value = value;
} }
public void setDensity(int density){ public void setDensity(int density){
this.density = density; this.density = density;
} }
} }

View File

@ -6,11 +6,15 @@ public class Table {
private int height; private int height;
private int width; private int width;
private ArrayList<ArrayList<Cell>> table; private ArrayList<ArrayList<Cell>> table;
private Simulator simulator;
//TODO-INPROGRESS : create constructor //TODO-INPROGRESS : create constructor
public Table(int height, int width) { public Table(int height, int width) {
this.height = height; this.height = height;
this.width = width; this.width = width;
this.simulator = simulator;
//initialize the table //initialize the table
int vertexCount = 3; int vertexCount = 3;
@ -30,10 +34,31 @@ public class Table {
//return the Cell object of coordinates x, y //return the Cell object of coordinates x, y
return table.get(x).get(y); return table.get(x).get(y);
} }
//TODO : set(Cell, x, y) set an object Cell to coordinate x, y //TODO-INPROGRESS : set(Cell, x, y) set an object Cell to coordinate x, y
public void setCell(Cell cell, int x, int y) {
table.get(x).set(y, cell);
}
//TODO : count around (xy) -> return how many around this cell public boolean isLoopingBorder() {
return simulator.isLoopingBorder();
}
//TODO-INPROGRESS : count around (xy) -> return how many around this cell
//2 modes needed : 1 with borders and 1 without
public int countNear(int x, int y) {
// Count the number of living cells around the specified cell
int count = 0;
return count;
}
//TODO : set agent (x y agent) load an agent to coordinates x,y //TODO : set agent (x y agent) load an agent to coordinates x,y
//TODO : set random (density) create a random table of determined density //TODO : set random (density) create a random table of determined density