#ifndef HRD_cal_H #define HRD_cal_H #include #include using namespace std; class HRD_cal { public: unsigned long long Change_int (char str[10]); string Change_str(unsigned long long dat); vector Calculate(unsigned long long Code); vector Calculate_All(unsigned long long Code); vector Calculate(unsigned long long Code, unsigned long long target); private: struct Case_cal { bool freeze[4][5]; // true -> no move ; false -> can move unsigned char status[4][5]; // 0xFF -> undefined ; 0xFE -> space unsigned char type[15]; // 0 -> 2 * 2 ; 1 -> 2 * 1 ; 2 -> 1 * 2 ; 3 -> 1 * 1 unsigned long long code; }; vector List; // 主队列 储存每个节点的信息 vector List_hash[0x10000]; // 哈希表 vector List_source; // 储存上一步编号 用于溯源 unsigned int now_move; // 当前正在计算的块的编号 unsigned int result; // 得到的目标编号 unsigned long long target_code; unsigned char mode; // 0 -> Calculate_All / 1 -> Calculate_Solution / 2 -> Calculate_Target bool flag; // 判断是否已找到目标 bool Parse_Code(Case_cal &dat, unsigned long long Code); void Get_Code(Case_cal &dat); void Find_Sub_Case(Case_cal &dat, int &num, int x, int y, bool addr[4][5]); void Build_Case(Case_cal &dat, int &num, int x, int y, bool addr[4][5]); void Find_Next_Case(Case_cal &dat_raw); void Add_Case(Case_cal *dat); void cal(unsigned long long Code); void init_data(); vector Get_Path(unsigned int result_num); }; #endif