}
}
for (int row = 0; row < PlantUniverse.UNIVERSE_HEIGHT; row++) {
for (int col = 0; col < PlantUniverse.UNIVERSE_WIDTH; col++) {
PlantUniverseCell cell = universe.getCell(row, col);
// see if we want to change the composition
if (row < PlantUniverse.GROUND_LINE) {
double[] cellVec = universe.getCellInfoVector(row, col);
double d1 = dist.calculate(cellVec, 0, genome, 0, PlantUniverse.CELL_VECTOR_LENGTH);
double d2 = dist.calculate(cellVec, 0, genome, PlantUniverse.CELL_VECTOR_LENGTH, PlantUniverse.CELL_VECTOR_LENGTH);
if (d1 < d2) {
cell.setLeafyness(cell.getLeafyness() * PlantUniverse.STEM_TRANSITION);
}
}
// Evaluate growth into each neighbor cell
if (universe.canGrow(row, col)) {
evaluateNeighbors(universe, row, col, genome, allowRoot, allowSurface);
}
}
}
// Copy the new composition back to the universe
for (int row = 0; row < PlantUniverse.UNIVERSE_HEIGHT; row++) {
for (int col = 0; col < PlantUniverse.UNIVERSE_WIDTH; col++) {
PlantUniverseCell cell = universe.getCell(row, col);
if (this.newComposition[row][col]) {
if (row >= PlantUniverse.GROUND_LINE) {
// Roots are always 100% stem for transfer.
cell.setLeafyness(0);
} else {
cell.setLeafyness(1.0);
}
cell.setEnergy(1.0);
cell.setNourishment(1.0);
}
}
}
}