Some Update and Save before making dangerous changes

This commit is contained in:
Noah
2021-10-09 12:46:42 +02:00
parent f471dd2879
commit 52dfecee4d
10 changed files with 30 additions and 1260 deletions
+27
View File
@@ -2,6 +2,7 @@ package game;
import gui.GUI;
import java.util.ArrayList;
import java.util.concurrent.ThreadLocalRandom;
public class Control {
@@ -166,6 +167,32 @@ public class Control {
}
// public void checkN(Cell[][] arr, Cell[][] futureGen, int columns, int rows) {
// ArrayList<Thread> threads = new ArrayList<>();
// final int NUM_OF_THREADS = 8; //Or can be passed as an argument
// for (int tid = 0; tid < NUM_OF_THREADS; tid++) {
// Integer thread_local_row_start = tid * rows / NUM_OF_THREADS;
// Integer thread_local_row_end = (tid + 1) * rows / NUM_OF_THREADS;
// Thread t = new Thread(() -> {
// for (int row = thread_local_row_start; row < thread_local_row_end; row++) {
// for (int column = 0; column < columns; column++) {
// countNeighbors(arr, row, column, rows, columns);
// evaluateNeighbors(arr[row][column], futureGen[row][column]);
// }
// }
// });
// t.start();
// threads.add(t);
// }
// for (Thread t : threads) {
// try {
// t.join();
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// }
// }
public boolean[][] nextGenBackup() {
gen++;