Random Bug Found. method nextGen() could be the cought

This commit is contained in:
Noah
2021-09-29 23:32:17 +02:00
parent d416fa834a
commit 81da9e247a
4 changed files with 26 additions and 16 deletions
+20 -13
View File
@@ -61,22 +61,27 @@ public class Control {
}
private void buildManuelGame() {
System.out.println("Test");
}
private void generateTask1() {
for (int x = 0; x < 6; x++) {
for (int y = 0; y < 6; y++) {
cells[x][y] = false;
for (int x = 0; x < xSize; x++) {
for (int y = 0; y < ySize; y++) {
cells[x][y] = true;
}
}
cells[1][2] = true;
cells[2][2] = true;
cells[2][4] = true;
cells[3][1] = true;
cells[3][3] = true;
cells[4][3] = true;
// cells[1][2] = true;
// cells[2][2] = true;
// cells[2][4] = true;
// cells[3][1] = true;
// cells[3][3] = true;
// cells[4][3] = true;
// cells[1][0] = true;
// cells[1][1] = true;
// cells[1][2] = true;
syncCells();
}
@@ -86,7 +91,7 @@ public class Control {
int x = rand(0, this.xSize);
int y = rand(0, this.ySize);
if (!cells[x][y]) {
this.cells[x][y] = true;
cells[x][y] = true;
} else {
i--;
}
@@ -103,6 +108,10 @@ public class Control {
}
}
public boolean[][] getCells() {
return cells;
}
public boolean[][] nextGen() {
gen ++;
System.out.println("Generation:" + gen);
@@ -136,8 +145,6 @@ public class Control {
}
}
return cells;
}