This commit is contained in:
Balthazar SQUINABOL 2024-04-25 10:42:18 +02:00
commit 7c4b0bc3b4
3 changed files with 7 additions and 25 deletions

View File

@ -16,3 +16,6 @@ With the implied additional rules:
4. Any living cell with two or three living neighbors continues to live, unchanged.
5. Any dead cell who doesnt have exactly 3 living neighbors stays dead,
unchanged.
TEST

View File

@ -117,7 +117,7 @@ public class Simulator extends Thread {
Table tempTable = new Table(this.height, this.width);
for(int x=0; x<width; x++) {
for(int y=0; y<height; y++) {
if (this.table.getCell(x, y).getValue()=1) {
if (table.getCell(x, y).getValue()==1) {
if (table.countNear(x,y)<2) {
tempTable.getCell(x,y).setValue(0);
} else if(table.countNear(x,y)>3) {

View File

@ -34,30 +34,9 @@ public class Table {
//return the Cell object of coordinates x, y
return table.get(x).get(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 : set(Cell, x, y) set an object Cell to coordinate x, y
//TODO : count around (xy) -> return how many around this cell
//TODO : set agent (x y agent) load an agent to coordinates x,y