跪求 迷宫问题 Java 算法描述
//输出路线publicvoidprintPath(PrintStreamout){getPath();out.println("Path:");if(currentLi...
//输出路线
public void printPath(PrintStream out) {
getPath();
out.println("Path:");
if (currentList.size() >= 2) {
currentList.remove(currentList.size() - 1);
currentList.remove(0);
}
Iterator<MazeCell> itr = currentList.iterator();
while (itr.hasNext()) {
MazeCell cell = itr.next();
path[cell.getX()][cell.getY()] = VISITED;
}
display(System.out, path);
}
public static void main(String[] args) {
Maze maze = new Maze();
maze.exitMaze(System.out);
maze.printPath(System.out);
}
}
请高人指点每条语句的意思,O(∩_∩)O谢谢 展开
public void printPath(PrintStream out) {
getPath();
out.println("Path:");
if (currentList.size() >= 2) {
currentList.remove(currentList.size() - 1);
currentList.remove(0);
}
Iterator<MazeCell> itr = currentList.iterator();
while (itr.hasNext()) {
MazeCell cell = itr.next();
path[cell.getX()][cell.getY()] = VISITED;
}
display(System.out, path);
}
public static void main(String[] args) {
Maze maze = new Maze();
maze.exitMaze(System.out);
maze.printPath(System.out);
}
}
请高人指点每条语句的意思,O(∩_∩)O谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询