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() {
return value;
}
public int getDensity() {
return density;
}
public void setValue(int value) {
this.value = value;
}
public void setDensity(int density){
this.density = density;
}
}

View File

@ -6,11 +6,15 @@ public class Table {
private int height;
private int width;
private ArrayList<ArrayList<Cell>> table;
private Simulator simulator;
//TODO-INPROGRESS : create constructor
public Table(int height, int width) {
this.height = height;
this.width = width;
this.simulator = simulator;
//initialize the table
int vertexCount = 3;
@ -30,9 +34,30 @@ public class Table {
//return the Cell object of coordinates x, 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);
}
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 : count around (xy) -> return how many around this cell
//TODO : set agent (x y agent) load an agent to coordinates x,y