Refactoring: grundsätzliche Zellenüberprüfung in countAliveNeighbours()

This commit is contained in:
Susanne 2025-02-15 20:44:51 +01:00
parent 566d74f5bf
commit b13b551045
2 changed files with 5 additions and 1 deletions

View File

@ -59,6 +59,10 @@ public class Life implements ILife {
}
private int countAliveNeighbours() {
return 3;
int count = 0;
if (isAlive(0, 0)) count++;
if (isAlive(0, 1)) count++;
if (isAlive(0, 2)) count++;
return count;
}
}