⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asincludes.h

📁 《游戏编程精粹》AI程序设计源代码
💻 H
字号:
//////////////////////////////////////////////////////////////////
// Class:	CAStar class (27/6/2001)
// File:	AsIncludes.h
// Author:	James Matthews
//
// Implements the A* algorithm.
// 
//
// Please visit http://www.generation5.org/ for the latest
// in Artificial Intelligence news, interviews, articles and
// discussion forums.
//

#ifndef NULL
#define NULL 0
#endif

#define ASNL_ADDOPEN		0
#define ASNL_STARTOPEN		1
#define ASNL_DELETEOPEN		2
#define ASNL_ADDCLOSED		3

#define ASNC_INITIALADD		0
#define ASNC_OPENADD_UP		1
#define ASNC_OPENADD		2
#define ASNC_CLOSEDADD_UP	3
#define ASNC_CLOSEDADD		4
#define ASNC_NEWADD			5

class _asNode {
	public:
		_asNode(int a = -1,int b = -1) : x(a), y(b), number(0), numchildren(0) {
			parent = next = NULL; dataptr = NULL;
			memset(children, 0, sizeof(children));
		}

		int			f,g,h;			// Fitness, goal, heuristic.
		int			x,y;			// Coordinate position
		int			numchildren;
		int			number;			// x*m_iRows+y
		_asNode		*parent;
		_asNode		*next;			// For Open and Closed lists
		_asNode		*children[8];	// Assumes square tiles
		void		*dataptr;		// Associated data
};

// Stack for propagation.
struct _asStack {
	_asNode	 *data;
	_asStack *next;
};

typedef int(*_asFunc)(_asNode *, _asNode *, int, void *);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -