}
public void decideNextStep(ConstructionHeuristicStepScope stepScope, Placement placement) {
int moveIndex = 0;
for (Move move : placement) {
ConstructionHeuristicMoveScope moveScope = new ConstructionHeuristicMoveScope(stepScope);
moveScope.setMoveIndex(moveIndex);
moveIndex++;
moveScope.setMove(move);
// Do not filter out pointless moves, because the original value of the entity(s) is irrelevant.
// If the original value is null and the variable is nullable, the move to null must be done too.
doMove(moveScope);
if (forager.isQuitEarly()) {
break;
}
if (termination.isPhaseTerminated(stepScope.getPhaseScope())) {
break;
}
}
stepScope.setSelectedMoveCount((long) moveIndex);
ConstructionHeuristicMoveScope pickedMoveScope = forager.pickMove(stepScope);
if (pickedMoveScope != null) {
Move step = pickedMoveScope.getMove();
stepScope.setStep(step);
if (logger.isDebugEnabled()) {
stepScope.setStepString(step.toString());
}
stepScope.setUndoStep(pickedMoveScope.getUndoMove());
stepScope.setScore(pickedMoveScope.getScore());
}
}