#ifndef HRD_analy_H #define HRD_analy_H #include #include using namespace std; class HRD_analy { public: struct Case_near; 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; unsigned int layer_num; unsigned int layer_index; Case_near *adjacent; }; struct Case_near { vector source_case; vector next_case; }; vector > Layer; // 储存全部层数据的节点 Case_cal Parse_dat; bool quiet = false; // true -> 静默模式 false -> 输出运算情况 // 布局的基本参数 int min_solution_step; // 最少的步数 int min_solution_num; // 最少步解的个数 vector min_solution_case; // 所有最少步解 vector solution_step; // 所有解对应的步数 int solution_num; // 解的个数 vector solution_case; // 所有解 int farthest_step; // 最远布局的步数 int farthest_num; // 最远布局的个数 vector farthest_case; // 所有最远的布局 unsigned long long Change_int (char str[10]); string Change_str(unsigned long long dat); bool Check_Code(unsigned long long code); bool Parse_Code(unsigned long long Code); void Analyse_Case(unsigned long long code); void Output_Detail(string File_name); private: vector Layer_hash[0x10000]; // 哈希表 Case_cal *now_move_case; unsigned int now_move_num, now_move_index; // 当前扫描节点的层编号 / 当前扫描节点的层中编号 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 Calculate(unsigned long long code); void Free_Data(); }; #endif