public class AStar
{
private List<Node> openList;
private List<Node> closeList;
private int startX,startY,endX,endY;
public AStar(){
openList=new ArrayList<Node>();
closeList=new ArrayList<Node>();
}
/*调用search方法*/
public static void main(String[] args) {
int[][] map = new int[][] {
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{1, 1, 1, 1, 0, 1, 1, 1, 1, 1 },
{1, 1, 1, 1, 0, 1, 1, 1, 1, 1 },
{1, 1, 1, 1, 0, 1, 1, 1, 1, 1 },
{1, 1, 1, 1, 0, 1, 1, 1, 1, 1 },
{1, 1, 1, 1, 0, 1, 1, 1, 1, 1 }
};
Astar astar=new Astar();
astar.search(0,0, 5, 9);
}
/*判断是否到达目标*/
public int search(int startX,int startY,int endX,int endY){
if((index