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

📄 ninegird.h

📁 人工智能中九宫问题的实现
💻 H
字号:
//
// Created by ZhaoHongWei 2004-12-6
// Feel free to use this code in any way you want.
#include <time.h>
#include <vector>
#include <algorithm>
using namespace std;
class CNineGird
{
public:
	struct PlaceList
    {
		DWORD		Place;
		PlaceList*	Left;
		PlaceList*	Right;
    };
	struct Scanbuf
	{
		DWORD Place;
		int ScanID;
	};
	struct PathList
	{
		unsigned char Path[9];
	};

private:
	PlaceList *m_pPlaceList;
	Scanbuf *m_pScanbuf;
	RECT m_rResetButton;
	RECT m_rAutoButton;

public:
	int m_iPathsize;
	clock_t m_iTime;
	UINT m_iStepCount;
	unsigned char m_iTargetChess[9];
	unsigned char m_iChess[9];
	HWND m_hClientWin;
	PathList *m_pPathList;
	bool m_bAutoRun;

private:
	inline bool AddTree(DWORD place , PlaceList*& parent);
	void FreeTree(PlaceList*& parent);
	inline void ArrayToDword(unsigned char *array , DWORD & data);
	inline void DwordToArray(DWORD data , unsigned char *array);
	inline bool MoveChess(unsigned char *array , int way);
	bool EstimateUncoil(unsigned char *array);
	void GetPath(UINT depth);
	
public:
	void MoveChess(int way);
	bool ComputeFeel();
	void ActiveShaw(HWND hView);
	void DrawGird(HDC hDC , RECT clientrect);
	void DrawChess(HDC hDC , RECT clientrect);
	void Reset();
	void OnButton(POINT pnt , HWND hView);
	
public:
	CNineGird();
	~CNineGird();
};

⌨️ 快捷键说明

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