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
+1 -1
View File
@@ -24,7 +24,7 @@ public class Clock extends Thread{
}
};
t.scheduleAtFixedRate(tt, 1, 120);
t.scheduleAtFixedRate(tt, 1, 100000);
}
+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;
}
+1 -1
View File
@@ -2,6 +2,6 @@ package game;
public enum StartMode {
Manuel, Randomized, Task1,
Manuel, Randomized, Task1, Blinker, Toad
}
+4 -1
View File
@@ -223,7 +223,9 @@ public class GUI {
modeBox = new JComboBox<String>();
modeBox.setBounds(180, 257, 100, 20);
addComboBoxEntry(modeBox, "Randomized");
addComboBoxEntry(modeBox, "CTTask1");
addComboBoxEntry(modeBox, "Task1");
addComboBoxEntry(modeBox, "Blinker");
addComboBoxEntry(modeBox, "Toad");
startButton = new JButton();
@@ -343,6 +345,7 @@ public class GUI {
jfGame.setLocationRelativeTo(null);
jfGame.setVisible(true);
}
private void initGameComponents() {