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

📄 node.h

📁 本人这学期写八数码作业
💻 H
字号:
#ifndef _NODE
#define _NODE
#include<iostream>
class Node{
public:
	Node();
	Node(int *data);
	Node(const Node& node);
	bool operator==(const Node& node);
	Node& operator=(const Node& node);
	void setParent(int parent);
	int getParent()const;
	void setSelf(int self);
	int getSelf()const;
	void swapValue(int first,int second);
	int getPos()const;
	void randomNode();
	std::pair<int,int> getMovePos()const;
	void setMovePos(std::pair<int,int> movePos);
	int diffence(const Node& node);
	friend std::ostream& operator <<(std::ostream& out,Node& node);
private:
mutable int parent_,self_;
mutable int data_[9];
std::pair<int,int>move;
};
class NodeFactory{
public:
	NodeFactory(const Node& node);
	bool hasNext();
	Node getNextNode();
private:
	static const int table[9][4];
	Node node_;
	int first_,second_;
	static int count;
};
#endif

⌨️ 快捷键说明

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