This commit is contained in:
Laure BEL 2024-05-29 18:33:44 +02:00
parent c2f9c4d976
commit 102bae29bb
1 changed files with 11 additions and 13 deletions

View File

@ -130,9 +130,9 @@ public class Simulator extends Thread {
agent.getY(),
ANIMAL_AREA_RADIUS);}
//if(!agent.liveTurn(
// neighbors,
// this)) {
// agents.remove(agent);
// neighbors,
//this)) {
//agents.remove(agent);
//{
@ -140,17 +140,15 @@ public class Simulator extends Thread {
for (int x = 0; x < getWidth(); x++) {
for (int y = 0; y < getHeight(); y++) {
int aliveNeighbors = countAliveNeighbors(x, y);
//for (int x = 0; x < getWidth(); x++) {
// for (int y = 0; y < getHeight(); y++) {
// int aliveNeighbors = countAliveNeighbors(x, y);
// if (world[x][y] == 1) {
// newWorld[x][y] = (aliveNeighbors < 2 || aliveNeighbors > 3) ? 0 : 1;
// } else {
if (world[x][y] == 1) {
newWorld[x][y] = (aliveNeighbors < 2 || aliveNeighbors > 3) ? 0 : 1;
} else {
newWorld[x][y] = (aliveNeighbors == 3) ? 1 : 0;
}
//world = newWorld;
}
}
world = newWorld;