////////////////////////////////////////////////////////////////////////// // // // // //写一个自己实现的A*搜索算法 ////////////////////////////////////////////////////////////////////////// #include "stdafx
h" #include #include #include #include #include using namespace std; const int nMapWidth = 8; const int nMapHeight = 8; struct Node { int nEnable; int nNodeMark; int nValue; int x; int y; Node():nEnable(0),nNodeMark(0),nValue(0),x(0),y(0){}; }; std::map m_OpenList; std::map m_CloseList; std::vector m_KeyList; Node m_MapNode[nMapWidth][nMapHeight]; //计算openlist中靠前节点周围的节点 void ComputerRound(int curx,int cury); //将一个新的节点加入到OPenList中 void AddNodeToOpenList(Node* pNode,int nNum); //打印地图 void Print(Node pNode[][nMapHeight]); void Print(Node pNode[][nMapHeight]) { for (int n = 0; n < nMapWidth; ++n) { fo