idk
This commit is contained in:
parent
d569d9e9f3
commit
68f4106a43
|
|
@ -10,20 +10,12 @@ public class Rules {
|
|||
|
||||
public Rules() {
|
||||
|
||||
survivalRulesArray = new int[0];
|
||||
birthRulesArray = new int[0];
|
||||
//survivalRulesArray = new int[0];
|
||||
//birthRulesArray = new int[0];
|
||||
}
|
||||
//initialize my arrays to empty
|
||||
|
||||
public int[] getBirthRulesArray() {
|
||||
return this.birthRulesArray;
|
||||
|
||||
}
|
||||
|
||||
public int[] getSurvivalRulesArray() {
|
||||
return this.survivalRulesArray;
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void loadRule(ArrayList<String> row) {
|
||||
String surviveRulesRow = row.get(0);
|
||||
|
|
@ -42,14 +34,14 @@ public class Rules {
|
|||
|
||||
}else {
|
||||
for (int x = 0; x < surviveCells.length; x++) {
|
||||
String elem = surviveCells[x];
|
||||
int value = Integer.parseInt(elem);
|
||||
String eleme = surviveCells[x];
|
||||
int value = Integer.parseInt(eleme);
|
||||
survivalRulesArray[x] = value;
|
||||
}
|
||||
//determines the number of alive neighboring cells needed to survive, and places them in the survivalRulesArray
|
||||
for (int x = 0; x < birthCells.length; x++) {
|
||||
String elem = birthCells[x];
|
||||
int value = Integer.parseInt(elem);
|
||||
String elemee = birthCells[x];
|
||||
int value = Integer.parseInt(elemee);
|
||||
birthRulesArray[x] = value;
|
||||
}
|
||||
//determines the number of alive neighboring cells needed to birth, and places them in the birthRules list
|
||||
|
|
@ -58,5 +50,15 @@ public class Rules {
|
|||
|
||||
|
||||
}
|
||||
|
||||
public int[] getBirthRulesArray() {
|
||||
return this.birthRulesArray;
|
||||
|
||||
}
|
||||
|
||||
public int[] getSurvivalRulesArray() {
|
||||
return this.survivalRulesArray;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,8 +178,7 @@ public class Simulator extends Thread {
|
|||
for (int y = 0; y < getHeight(); y++) {
|
||||
int aliveNeighbors = countAliveNeighbors(x, y);
|
||||
if (world.getCell(x, y) == 1) {
|
||||
nextWorld[x][y] = 1;
|
||||
//survives(aliveNeighbors) ? 1 : 0;
|
||||
nextWorld[x][y] = survives(aliveNeighbors) ? 1 : 0;
|
||||
} else {
|
||||
nextWorld[x][y] = bornes(aliveNeighbors) ? 1 : 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue