Merge branch 'main' of https://gitarero.ecam.fr/guillaume.bonabau/OOP_F1_Project
This commit is contained in:
commit
7c4b0bc3b4
|
|
@ -15,4 +15,7 @@ spreading or growth)
|
||||||
With the implied additional rules:
|
With the implied additional rules:
|
||||||
4. Any living cell with two or three living neighbors continues to live, unchanged.
|
4. Any living cell with two or three living neighbors continues to live, unchanged.
|
||||||
5. Any dead cell who doesn’t have exactly 3 living neighbors stays dead,
|
5. Any dead cell who doesn’t have exactly 3 living neighbors stays dead,
|
||||||
unchanged.
|
unchanged.
|
||||||
|
|
||||||
|
|
||||||
|
TEST
|
||||||
|
|
@ -117,7 +117,7 @@ public class Simulator extends Thread {
|
||||||
Table tempTable = new Table(this.height, this.width);
|
Table tempTable = new Table(this.height, this.width);
|
||||||
for(int x=0; x<width; x++) {
|
for(int x=0; x<width; x++) {
|
||||||
for(int y=0; y<height; y++) {
|
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) {
|
if (table.countNear(x,y)<2) {
|
||||||
tempTable.getCell(x,y).setValue(0);
|
tempTable.getCell(x,y).setValue(0);
|
||||||
} else if(table.countNear(x,y)>3) {
|
} else if(table.countNear(x,y)>3) {
|
||||||
|
|
|
||||||
|
|
@ -34,31 +34,10 @@ 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-INPROGRESS : set(Cell, x, y) set an object Cell to coordinate x, y
|
//TODO : 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() {
|
//TODO : count around (xy) -> return how many around this cell
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue