From e07311f7bf7da2bc78a2e7bbb41aa0bb6dadc1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=C3=A9o?= Date: Wed, 29 May 2024 16:47:20 +0200 Subject: [PATCH] test for the makestep --- src/backend/Simulator.java | 3 ++- src/backend/World.java | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/backend/Simulator.java b/src/backend/Simulator.java index 5e1baae..e213015 100644 --- a/src/backend/Simulator.java +++ b/src/backend/Simulator.java @@ -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; } diff --git a/src/backend/World.java b/src/backend/World.java index 82137d6..3c1cfe9 100644 --- a/src/backend/World.java +++ b/src/backend/World.java @@ -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; + 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("]"); + } + }