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

📄 state.h

📁 八数码小游戏
💻 H
字号:
#pragma once

struct Position
{
	int row;
	int col;
};

const Position offset[4] =
{
	{0, 1},  // right
	{1, 0},  // down
	{0, -1}, // left
	{-1, 0}, // up
};

class CState
{
	friend class CEightNumView;
	friend class CStateList;
	friend int Distance(CState* a, CState* b);
public:
	CState(void);
	CState(const CState& state);
	~CState(void);
	bool IsEvenState();
	void Free();
	void GetPos(int d, int& r, int& c);
	bool NewChild(int dir, CState* destState, CState*& c);
	void RemoveChild(CState* c); // but don't delete the space!
	void UpdateChildren(int var);
private:
	int num[3][3];
	int childNum;
	CState* child[4];
	CState* parent;
	int g, h;
};

⌨️ 快捷键说明

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