/** * Worker function to determine whether we should discard the current path * (due to it being illegal or redundant) or keep generating child nodes * @param path The move path to consider * @return Whether to keep or dicsard. */ protected boolean discardPath(MovePath path, CoordsWithFacing pathDestination) { boolean maxMPExceeded = path.getMpUsed() > path.getEntity().getRunMP(); // having generated the child, we add it and (recursively) any of its children to the list of children to be returned // unless it is illegal or exceeds max MP, in which case we discard it // (max mp is maybe redundant)? if(!path.isMoveLegal() || maxMPExceeded) { return true; } // terminator conditions: // we've visited this hex already and the path we are considering is longer than the previous path that visited this hex if(visitedCoords.containsKey(pathDestination) && visitedCoords.get(pathDestination).intValue() < path.getMpUsed()) { return true; } return false; }
@Override public boolean shouldStay(MovePath movePath) { boolean isLegal = movePath.isMoveLegal(); return isLegal && (Compute.stackingViolation(getGame(), mover.getId(), movePath.getFinalCoords()) == null); } };
if((path == null) || !path.isMoveLegal()) { continue;
if(!childPath.isMoveLegal()) { continue;
MovePath paths[]; int optionType; if (stepForward.isMoveLegal() && stepBackward.isMoveLegal()){ options = new Object[3]; paths = new MovePath[3]; paths[2] = null; optionType = JOptionPane.YES_NO_CANCEL_OPTION; } else if (stepForward.isMoveLegal()){ options = new Object[2]; paths = new MovePath[2];
if (!path.isMoveLegal()) { if (path.getLastStep() == null) { LogAeroMoveLegalityEvaluation("illegal move with null last step", path);