Browse Source

update engine

master
Dnomd343 4 years ago
parent
commit
058e95ad28
  1. 4
      src/engine/HRD_analy.cpp
  2. 4
      src/engine/HRD_analy.h
  3. 4
      src/engine/HRD_cal.h
  4. 4
      src/engine/HRD_group.h
  5. 4
      src/engine/HRD_statistic.h

4
src/engine/HRD_analy.cpp

@ -319,11 +319,11 @@ void HRD_analy::Analyse_Case(unsigned long long code) { // 分析输入编码的
for (j = 0; j < Layer[i].size(); j++) { for (j = 0; j < Layer[i].size(); j++) {
if ((Layer[i][j]->code >> 32) == 0xD) { // 2 * 2块在出口位置 if ((Layer[i][j]->code >> 32) == 0xD) { // 2 * 2块在出口位置
min_solution_step = i; // 找到最少步数 min_solution_step = i; // 找到最少步数
j = Layer[i].size(); // 跳出两层循环 goto get_min_solution_step; // 跳出两层循环
i = Layer.size();
} }
} }
} }
get_min_solution_step:;
if (min_solution_step == -1) {return;} // 无解则退出 if (min_solution_step == -1) {return;} // 无解则退出
for (i = 0; i < Layer[min_solution_step].size(); i++) { // 遍历最少步所在层 for (i = 0; i < Layer[min_solution_step].size(); i++) { // 遍历最少步所在层
if ((Layer[min_solution_step][i]->code >> 32) == 0xD) { // 判断是否为解 if ((Layer[min_solution_step][i]->code >> 32) == 0xD) { // 判断是否为解

4
src/engine/HRD_analy.h

@ -6,7 +6,7 @@
using namespace std; using namespace std;
class HRD_analy { class HRD_analy {
public: public:
~HRD_analy(); ~HRD_analy();
struct Case_cal { struct Case_cal {
bool freeze[4][5]; // true -> no move ; false -> can move bool freeze[4][5]; // true -> no move ; false -> can move
@ -45,7 +45,7 @@ class HRD_analy {
bool Output_Path(vector <unsigned long long> target, string File_name); bool Output_Path(vector <unsigned long long> target, string File_name);
void Output_Graph(unsigned long long code, unsigned int square_width, unsigned int square_gap, char str[2]); void Output_Graph(unsigned long long code, unsigned int square_width, unsigned int square_gap, char str[2]);
private: private:
Case_cal *now_move_case; Case_cal *now_move_case;
vector <Case_cal *> *Layer_hash = new vector <Case_cal *> [0x10000]; // 哈希表 vector <Case_cal *> *Layer_hash = new vector <Case_cal *> [0x10000]; // 哈希表
unsigned int now_move_num, now_move_index; // 当前扫描节点的层编号 / 当前扫描节点的层中编号 unsigned int now_move_num, now_move_index; // 当前扫描节点的层编号 / 当前扫描节点的层中编号

4
src/engine/HRD_cal.h

@ -6,7 +6,7 @@
using namespace std; using namespace std;
class HRD_cal { class HRD_cal {
public: public:
~HRD_cal(); ~HRD_cal();
unsigned long long Change_int(char str[10]); unsigned long long Change_int(char str[10]);
string Change_str(unsigned long long dat); string Change_str(unsigned long long dat);
@ -15,7 +15,7 @@ class HRD_cal {
vector <unsigned long long> Calculate_All(unsigned long long code); vector <unsigned long long> Calculate_All(unsigned long long code);
vector <unsigned long long> Calculate(unsigned long long code, unsigned long long target); vector <unsigned long long> Calculate(unsigned long long code, unsigned long long target);
private: private:
struct Case_cal { struct Case_cal {
bool freeze[4][5]; // true -> no move ; false -> can move bool freeze[4][5]; // true -> no move ; false -> can move
unsigned char status[4][5]; // 0xFF -> undefined ; 0xFE -> space unsigned char status[4][5]; // 0xFF -> undefined ; 0xFE -> space

4
src/engine/HRD_group.h

@ -6,13 +6,13 @@
using namespace std; using namespace std;
class HRD_group { class HRD_group {
public: public:
unsigned long long Change_int(char str[10]); unsigned long long Change_int(char str[10]);
string Change_str(unsigned long long dat); string Change_str(unsigned long long dat);
void Batch_Analyse(unsigned long long seed, string name_farthest, string name_solution, bool is_output_solution); void Batch_Analyse(unsigned long long seed, string name_farthest, string name_solution, bool is_output_solution);
bool Multi_Analyse(string seed_File_name, string name_farthest, string name_solution, bool is_output_solution); bool Multi_Analyse(string seed_File_name, string name_farthest, string name_solution, bool is_output_solution);
private: private:
struct Case_cal { struct Case_cal {
unsigned long long code; unsigned long long code;
unsigned char status[4][5]; // 0xFF -> undefined ; 0xFE -> space unsigned char status[4][5]; // 0xFF -> undefined ; 0xFE -> space

4
src/engine/HRD_statistic.h

@ -6,11 +6,11 @@
using namespace std; using namespace std;
class HRD_statistic { class HRD_statistic {
public: public:
void Find_All_Case(string File_name); void Find_All_Case(string File_name);
void All_Statistic(); void All_Statistic();
private: private:
struct Case { struct Case {
unsigned int id; unsigned int id;
bool is_mirror; bool is_mirror;

Loading…
Cancel
Save