Browse Source

update engine

master v0.1
Dnomd343 5 years ago
parent
commit
70e1dedfdc
  1. 2
      src/engine/HRD_analy.cpp
  2. 2
      src/engine/HRD_cal.cpp
  3. 2
      src/engine/HRD_group.cpp
  4. 2
      src/engine/HRD_statistic.h
  5. 6
      src/engine/main.cpp

2
src/engine/HRD_analy.cpp

@ -374,7 +374,7 @@ void HRD_analy::Find_Next_Case(Case_cal &dat_raw) { // 找到下一步移动的
for (y = 0; y < 5; y++) { // 遍历整个棋盘 for (y = 0; y < 5; y++) { // 遍历整个棋盘
for (x = 0; x < 4; x++) { for (x = 0; x < 4; x++) {
if (dat_raw.freeze[x][y] == true) {continue;} // 遇到freeze为true的跳过 if (dat_raw.freeze[x][y] == true) {continue;} // 遇到freeze为true的跳过
num = dat.status[x][y]; // 统一修改(x, y)块 减少代码量 num = dat.status[x][y]; // 统一修改(x, y)块
dat.status[x][y] = 0xFE; dat.status[x][y] = 0xFE;
dat.freeze[x][y] = true; dat.freeze[x][y] = true;
for (i = 0; i < 4; i++) { // 初始化 for (i = 0; i < 4; i++) { // 初始化

2
src/engine/HRD_cal.cpp

@ -159,7 +159,7 @@ void HRD_cal::Find_Next_Case(Case_cal &dat_raw) { // 找到下一步移动的情
for (y = 0; y < 5; y++) { // 遍历整个棋盘 for (y = 0; y < 5; y++) { // 遍历整个棋盘
for (x = 0; x < 4; x++) { for (x = 0; x < 4; x++) {
if (dat_raw.freeze[x][y] == true) {continue;} // 遇到freeze为true的跳过 if (dat_raw.freeze[x][y] == true) {continue;} // 遇到freeze为true的跳过
num = dat.status[x][y]; // 统一修改(x, y)块 减少代码量 num = dat.status[x][y]; // 统一修改(x, y)块
dat.status[x][y] = 0xFE; dat.status[x][y] = 0xFE;
dat.freeze[x][y] = true; dat.freeze[x][y] = true;
for (i = 0; i < 4; i++) { // 初始化 for (i = 0; i < 4; i++) { // 初始化

2
src/engine/HRD_group.cpp

@ -246,7 +246,7 @@ vector <unsigned long long> HRD_group::Find_Next_Case(unsigned long long Code) {
} }
} }
addr[x][y] = true; // 加入当前块 防止重复查询 addr[x][y] = true; // 加入当前块 防止重复查询
num = dat.status[x][y]; // 统一修改(x, y)块 减少代码量 num = dat.status[x][y]; // 统一修改(x, y)块
dat.status[x][y] = 0xFE; dat.status[x][y] = 0xFE;
switch (dat.type[num]) { switch (dat.type[num]) {
case 0: // 2 * 2 case 0: // 2 * 2

2
src/engine/HRD_statistic.h

@ -26,7 +26,7 @@ class HRD_statistic {
unsigned int group_num; unsigned int group_num;
unsigned int group_index; unsigned int group_index;
}; };
vector <Case *> All_Case; // 记录所有布局的信息 vector <Case *> All_Case; // 记录所有布局的信息
void Get_seed(); void Get_seed();
void Find_All_Case(); void Find_All_Case();

6
src/engine/main.cpp

@ -54,7 +54,7 @@ void show_case(string str, string width) {
HRD_analy analy; HRD_analy analy;
int square_width; int square_width;
char output_char[3] = "&%"; char output_char[3] = "&%";
istringstream is(width); // 借用字符串流对象将string转为int istringstream is(width); // 借用字符串流对象将string转为int
is >> square_width; is >> square_width;
cout << endl; cout << endl;
cout << "Code: " << analy.Change_str(code) << endl; cout << "Code: " << analy.Change_str(code) << endl;
@ -320,7 +320,7 @@ void find_all_code(string File_name) {
} }
void show_help() { void show_help() {
cout << "(version: v0.0)" << endl; cout << "(version: v0.1)" << endl;
cout << "Usage of HRD_engine:" << endl; cout << "Usage of HRD_engine:" << endl;
cout << endl; cout << endl;
cout << " --show <code> [square_width]" << endl; cout << " --show <code> [square_width]" << endl;
@ -395,7 +395,7 @@ void parameter_err() {
} }
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
cout << "Klotski engine by Dnomd343" << endl; cout << endl << "Klotski engine by Dnomd343" << endl;
if (argc <= 1) { if (argc <= 1) {
cout << "no parameter" << endl; cout << "no parameter" << endl;
cout << "You can try \"--help\" for more information" << endl; cout << "You can try \"--help\" for more information" << endl;

Loading…
Cancel
Save