private BasicParameter deadParameter = new BasicParameter("DEAD", 25.0, 0.0, 100.0);
// Controls the saturation.
private BasicParameter saturationParameter = new BasicParameter("SAT", 90.0, 0.0, 100.0);
+ // Controls the number of neighbors needed to birth a new life.
+ private BasicParameter fertilityParameter = new BasicParameter("FERT", 2.0, 1.0, 5.0);
+
public final double MIN_ALIVE_PROBABILITY = 0.2;
public final double MAX_ALIVE_PROBABILITY = 0.9;
addParameter(rateParameter);
addParameter(randomParameter);
addParameter(deadParameter);
- addParameter(saturationParameter);
+ addParameter(saturationParameter);
+ addParameter(fertilityParameter);
addModulator(xPos).trigger();
}
Integer alive_neighbor_count = countLiveNeighbors(cube_state);
boolean before_alive = cube_state.alive;
boolean after_alive = before_alive;
+ int fetility_count = (int) fertilityParameter.getValuef();
if(cube_state.alive) {
if(alive_neighbor_count < 2 || alive_neighbor_count > 3) {
}
} else {
- if(alive_neighbor_count == 3) {
+ if(alive_neighbor_count == fetility_count) {
after_alive = true;
} else {
after_alive = false;