diff --git a/src/backend/Rules.java b/src/backend/Rules.java index 1896db0..561b4cf 100644 --- a/src/backend/Rules.java +++ b/src/backend/Rules.java @@ -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 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; + + } } diff --git a/src/backend/Simulator.java b/src/backend/Simulator.java index 9964506..77cef13 100644 --- a/src/backend/Simulator.java +++ b/src/backend/Simulator.java @@ -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; }