📄 hrd_calculate.h
字号:
#include <windows.h>
const unsigned int MAX_NODES = 100000;
const unsigned __int8 BLANK = 0;
const unsigned __int8 SOLDIER = 1;
const unsigned __int8 GENERAL1 = 2;
const unsigned __int8 GENERAL2 = 3;
const unsigned __int8 GENERAL3 = 4;
const unsigned __int8 GENERAL4 = 5;
const unsigned __int8 GENERAL5 = 6;
const unsigned __int8 CAOCAO = 7;
const unsigned __int8 HGENERAL=2;
const unsigned __int8 VGENERAL=3;
const int SUCCESS = -1;
const int ADD_ONE_NODE=1;
const int ADD_NO_NODE=0;
struct node
{
unsigned __int8 state[5][4];
node * prior;
};
struct s_node
{
unsigned __int64 state;
unsigned __int64 ext_state;
s_node * prior;
};
class hrd_calculate
{
private:
s_node * first; //指向表首
s_node * last; //总指向表尾
s_node * search;//表示正在被搜索的节点
s_node * current_last;//当前搜索深度的最后一个节点
unsigned int table[300];
public:
int depth;//当前搜索的深度
int totalnodes;//节点数
node out[300]; //输出状态
hrd_calculate();
virtual ~hrd_calculate();
void InitState(unsigned __int8 state[5][4]);//设定初始状态
int SearchOneNode(node *c);//检测某一节点的下一步
int AddNode(node c);//将节点加入队列
bool SearchNode(); //搜索节点,建立状态表
void OutputStep(); //输出状态
void NodeToSNode(node * pnode,s_node* psnode);//节点转换
void SNodeToNode(s_node* psnode,node * pnode);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -