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

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

No files matched your search

Binary file not shown.
+5 -1
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;
}
}