From 9909c235c904bd335cc7ff0d275f125547999aa2 Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Wed, 1 Jul 2020 21:35:20 +0800 Subject: [PATCH] update HRD_group --- HRD_group.cpp | 55 +++++++++++++++------------------------------------ 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/HRD_group.cpp b/HRD_group.cpp index 1b0b762..3650f4e 100644 --- a/HRD_group.cpp +++ b/HRD_group.cpp @@ -52,25 +52,25 @@ void Case_detail_init(Case_detail &dat); Case_detail* Analyse_Case(Case *start); void Analyse_Group(vector dat); void Output_detail(Case_detail *dat); +void Batch_Analyse(unsigned long long seed, string name_farthest, string name_solution, bool is_output_solution); int main() { cout << "HRD batch analyser by Dnomd343" << endl; + Batch_Analyse(0x1A9BF0C00, "farthest.csv", "solution.csv", false); + cout << "bye..." << endl; + return 0; +} + +void Batch_Analyse(unsigned long long seed, string name_farthest, string name_solution, bool is_output_solution) { HRD_cal cal; - unsigned long long seed; vector dat; - seed = 0x1A9BF0C00; - if (cal.Check_Code(seed) == false) { - return 0; - } + if (cal.Check_Code(seed) == false) {return;} dat = cal.Calculate_All(seed); sort(dat.begin(), dat.end()); - File_name_farthest = "farthest.csv"; - File_name_solution = "solution.csv"; - Output_solution_case = true; - + File_name_farthest = name_farthest; + File_name_solution = name_solution; + Output_solution_case = is_output_solution; Analyse_Group(dat); - cout << "bye..." << endl; - return 0; } void Analyse_Group(vector dat) { // 传入整个群 并将结果以csv格式输出到文件 @@ -149,7 +149,10 @@ void Output_detail(Case_detail *dat) { } } output_solution << "," << (*dat).solution_num; - if (Output_solution_case == false) {return;} + if (Output_solution_case == false) { + output_solution << endl; + return; + } output_solution << ","; for (i = 0; i < (*dat).solution_case.size(); i++) { output_solution << Change_str((*dat).solution_case[i]); @@ -160,33 +163,7 @@ void Output_detail(Case_detail *dat) { } output_solution << endl; } -/* -void Show_detail(Case_detail *dat) { - unsigned int i; - cout << "============================" << endl; - cout << "farthest_step = " << (*dat).farthest_step << endl; - cout << "farthest_num = " << (*dat).farthest_num << endl; - cout << "farthest_case: " << endl; - for (i = 0; i < (*dat).farthest_case.size(); i++) { - cout << " " << Change_str((*dat).farthest_case[i]) << endl; - } - cout << "============================" << endl; - cout << "min_solution_step = " << (*dat).min_solution_step << endl; - cout << "min_solution_num = " << (*dat).min_solution_num << endl; - cout << "min_solution_case: " << endl; - for (i = 0; i < (*dat).min_solution_case.size(); i++) { - cout << " " << Change_str((*dat).min_solution_case[i]) << endl; - } - cout << "============================" << endl; - cout << "solution_num = " << (*dat).solution_num << endl; - cout << "solution_case(solution_step): " << endl; - for (i = 0; i < (*dat).solution_case.size(); i++) { - cout << " " << Change_str((*dat).solution_case[i]); - cout << "(" << (*dat).solution_step[i] << ")" << endl; - } - cout << "============================" << endl; -} -*/ + Case_detail* Analyse_Case(Case *start) { // 根据关系网计算布局的参数 unsigned int i, k; vector Case_Stack;