protected Move reproduceTowardsFood(MoveInput input) { for (int i = 1, size = input.getFoodPresent().length; i < size; i++) { if (!shouldMoveToLocation(i, input)) continue; return reproductionMove(i); } return null; }
@Override public Move move(MoveInput input) { System.out.println( "Brethren: " + getMemory().getOwnPopulationRatio() + " cutoff: " + brethrenCutoff + "brethren: " + getMemory().getBrethrenSeen() + " neighbors: " + getMemory().getNeighborsSeen()); if (getMemory().getBiomassRatio() > cutoff) return null; if (getMemory().getOwnPopulationRatio() > brethrenCutoff) return null; if (PlayerUtil.noEmptyNeighboringSpaces(input)) return null; if (!shouldReproduce(input)) return null; Move move = reproduceTowardsFood(input); if (move != null) return move; if (input.noNeighborAt(getPreferredReproduceDirection())) return reproductionMove(getPreferredReproduceDirection()); return randomReproduce(input); }
protected boolean okToMoveToLocation(int i, MoveInput input) { return !input.isNeighborAt(i); }
protected boolean shouldMoveToLocation(int i, MoveInput input) { return input.isFoodPresentAt(i) && !input.isNeighborAt(i); }
protected boolean weHaveEnoughEnergyToReproduce(MoveInput input) { return input.getEnergyLeft() > getPlayer().getMaximumEnergyPerOrganismM() * 0.75 && nStepsHavePassedSinceWeLastHadChild(10); }