datatype.h

来自「人工智能的经典八皇后问题,这个算法是a*算法.利用这个算法可以解决八数码,八皇后」· C头文件 代码 · 共 79 行

H
79
字号
// DataType.h: interface for the CPathNode class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DATATYPE_H__DCADB281_C88A_11D4_B2EE_9A2EC5627551__INCLUDED_)
#define AFX_DATATYPE_H__DCADB281_C88A_11D4_B2EE_9A2EC5627551__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CPathNode  
{
public:
	CPathNode();
	CPathNode(BYTE n,const CPoint &p,int width);
	CPathNode(BYTE n,int d,const CPoint &p,int width);
	int width;
	void DrawNode(CDC *pDC);
	CPoint P1;
	CPoint P0;
	CPathNode(BYTE n)
	{
		state[16]='\0';
		N=n;
		depth=0;
		next=NULL;
		parent=NULL;
	}
	CPathNode(BYTE n,UINT d)
	{
		state[16]='\0';
		N=n;
		depth=d;
		next=NULL;
		parent=NULL;
	}
	unsigned char state[17];
	BYTE space;
	BYTE move;
	BYTE rule;
	UINT depth;
	BYTE N;
	int weight;
	CPathNode *next;
	CPathNode *parent;

	virtual ~CPathNode()
	{
	} 

};


class CResult  
{
public:
	CResult()
	{
		moves=NULL;
		rules=NULL;
		depth=0;
	}
	UINT generate;
	UINT split;
	UINT depth;
	unsigned char *moves;
	BYTE *rules;

	virtual ~CResult()
	{
		if (depth>0 && moves) delete[] moves;
		if (depth>0 && rules) delete[] rules;

	}
};

#endif // !defined(AFX_DATATYPE_H__DCADB281_C88A_11D4_B2EE_9A2EC5627551__INCLUDED_)

⌨️ 快捷键说明

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