/** * Generates a list of possible step combinations that should be done at the beginning of a path * This implementation generates exactly one path, which is either no moves or one hex forward when velocity > 0 * @return "List" of all possible "starting" paths */ @Override protected List<MovePath> generateStartingPaths(MovePath startingEdge) { List<MovePath> startingPaths = new ArrayList<>(); // calculate max and min safe velocity // in space, we can go as slow or as fast as we want. IAero aero = (IAero) startingEdge.getEntity(); int maxThrust = AeroPathUtil.calculateMaxSafeThrust(aero); int maxVelocity = aero.getCurrentVelocity() + maxThrust; int minVelocity = Math.max(0, aero.getCurrentVelocity() - maxThrust); startingPaths.addAll(AeroPathUtil.generateValidAccelerations(startingEdge, minVelocity, maxVelocity)); // all non-zero-velocity paths must move at least one hex forward for(MovePath path : startingPaths) { if(path.getFinalVelocity() > 0) { path.addStep(MoveStepType.FORWARDS); } } return startingPaths; }
int maxVelocity = Math.min(getMaximumVelocity(aero), aero.getCurrentVelocity() + maxThrust); int minVelocity = Math.max(getMinimumVelocity(aero), aero.getCurrentVelocity() - maxThrust); Collection<MovePath> validAccelerations = AeroPathUtil.generateValidAccelerations(startingEdge, minVelocity, maxVelocity);