摘要:
1 #ifndef __BFS__H 2 #define __BFS__H 3 4 #include "AIDefine.h" 5 #include 6 7 class BFS 8 { 9 private:10 BFS();11 public:12 static bool find(const PointI &size, const PointI &start, const PointI &end, AI_VisitFun visitFun, Path **path = NULL,13 EFindType findType = EFIND_TYPE8 阅读全文
摘要:
1 #ifndef __BSTAR__H 2 #define __BSTAR__H 3 4 #include "AIDefine.h" 5 #include 6 7 class BStar 8 { 9 private: 10 BStar(); 11 public: 12 static bool find(const PointI &size, const PointI &start, const PointI &end, AI_VisitFun visitFun, Path **path = NULL) 13 { 14 if(s... 阅读全文
摘要:
1 #ifndef __ASTAR__H 2 #define __ASTAR__H 3 4 #include "AIDefine.h" 5 #include "../Common/PriorityQueue.h" 6 7 class AStar 8 { 9 private: 10 AStar(); 11 public: 12 static bool find(const PointI &size, const PointI &start, const PointI &end, AI_VisitFun visitFun, Path 阅读全文
摘要:
1 #include "AIDefine.h"2 3 PointI AI_FindHelpPoint[8] = {PointI(-1,0),PointI(0,-1),PointI(1,0),PointI(0,1),PointI(-1,-1),PointI(1,-1),PointI(1,1),PointI(-1,1)}; 阅读全文
摘要:
1 #ifndef __AIDEFINE__H 2 #define __AIDEFINE__H 3 4 #include 5 #include "../Common/Path.h" 6 7 #define MATH_SQRT2 1.4142135623731f 8 enum EFindType 9 {10 EFIND_TYPE4 = 4,//must be 411 EFIND_TYPE8 = 8//must be 812 };13 extern PointI AI_FindHelpPoint[8];14 typedef float (*AI_DitanceFun)(in.. 阅读全文
摘要:
1 #ifndef __PRIORITYQUEUE__H 2 #define __PRIORITYQUEUE__H 3 4 #include 5 6 template, typename Container = std::deque > 7 class PriorityQueue 8 { 9 public:10 bool empty() const11 {12 return (m_container.empty());13 }14 15 unsigned int size() const16 {17 return ... 阅读全文
摘要:
1 #ifndef __PATH__H 2 #define __PATH__H 3 4 #include 5 #include "Point.h" 6 7 class Path 8 { 9 public:10 typedef std::list PathList;11 typedef PathList::const_iterator Iterator;12 public:13 Path():m_find(false),m_step(0),m_dis(0.0f){}14 Path(bool find, float dis):m_find(find),m_s... 阅读全文
摘要:
1 #ifndef __POINT__H 2 #define __POINT__H 3 4 template 5 struct Point 6 { 7 Point():x(0),y(0){} 8 Point(const T _x, const T _y):x(_x),y(_y){} 9 inline void set(const int _x, const int _y){x = _x; y = _y;}10 inline void set(const Point &point){x = point.x; y = point.y;}11 T x;12... 阅读全文