Refactoring: grundsätzliche Zellenüberprüfung in countAliveNeighbours()
This commit is contained in:
Binary file not shown.
+5
-1
@@ -59,6 +59,10 @@ public class Life implements ILife {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int countAliveNeighbours() {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user