test for the makestep

This commit is contained in:
Timéo 2024-05-29 16:47:20 +02:00
parent 75e9fad8d6
commit e07311f7bf
2 changed files with 18 additions and 5 deletions

View File

@ -178,7 +178,8 @@ 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] = survives(aliveNeighbors) ? 1 : 0;
nextWorld[x][y] = 1;
//survives(aliveNeighbors) ? 1 : 0;
} else {
nextWorld[x][y] = bornes(aliveNeighbors) ? 1 : 0;
}

View File

@ -35,14 +35,26 @@ public class World {
public void setWorld(int[][] actualworld, int width, int height) {
this.world = actualworld;
public void setWorld(int[][] world, int width, int height) {
this.world = world;
this.width = width;
this.height = height;
printArray (world);
}
//initializes the world
public void printArray(int[][] array) {
for (int i = 0; i < array.length; i++) {
System.out.print("[");
for (int j = 0; j < array[i].length; j++) {
System.out.print(array[i][j]);
if (j < array[i].length - 1) {
System.out.print(", ");
}
}
System.out.println("]");
}
}