急求:初识A*算法 这个的源代码!!

来源:百度知道 编辑:UC知道 时间:2024/06/04 17:46:49
这个是比较经典的一道题了
希望求到代码
http://www.vckbase.com/document/viewdoc/?id=1422
最好是VC++或者JAVA

#include <iostream>
#include <cmath>
using namespace std;

struct tnode{

int gvalue;//以下3个参数是估计函数
int hvalue;
int fvalue;
tnode* parent;//不是父节点,而是指向当前节点
tnode* next;//指向链表的下一个节点
int pass;
int nodevalue;//唯一标示节点
};

tnode table[5][5];//存储地图5*5
int startx,starty,endx,endy;
tnode openlist,closelist;

void computervalue(const int curx,const int cury);
int intsearch(tnode *plist,int value);//C++需要int
void addopenlist(int hx,int hy);
void handlenode(int hx,int hy,int curx,int cury);

void main()
{
tnode *pp;
int x,y;
int i,j;//要定义
for ( i=0;i<=4;i++)//初始化
for ( j=0;j<=4;j++)
{
table[i