Browse Source

update docs

master
Dnomd343 5 years ago
parent
commit
ec620ac801
  1. 12
      README.md
  2. 84
      docs/demo.md
  3. 2
      docs/group_num.md
  4. 36
      docs/usage.md

12
README.md

@ -75,10 +75,12 @@
![visual_tool](./docs/images/visual_tool.png) ![visual_tool](./docs/images/visual_tool.png)
使用方法 工具介绍
+ 通过鼠标拖拽画出棋子 + 通过鼠标拖拽画出棋子
+ 绘制时违反规则会出现提示
+ 通过单击删除棋子 + 通过单击删除棋子
+ 下方文本框输入编码自动生成布局 + 下方文本框输入编码自动生成布局
@ -91,6 +93,12 @@
+ 完成按钮可补0生成九位编码 + 完成按钮可补0生成九位编码
下载
[Github仓库](./res/HRD_Virual.exe)
[备用链接](https://hrd.dnomd343.top/download/HRD_Virual.exe)
### 计算引擎 ### 计算引擎
@ -98,7 +106,7 @@
源码编译后是命令行程序,需输入指定命令进行运算工作,具体[使用方法](./docs/usage.md)将在这篇文档中阐述。 源码编译后是命令行程序,需输入指定命令进行运算工作,具体[使用方法](./docs/usage.md)将在这篇文档中阐述。
引擎封装了多个类实现不同功能,如果你有其他需求可以直接调用它的封装函数实现,这是它库函数的[使用演示](./docs/class.md)。 引擎封装了多个类实现不同功能,如果你有其他需求可以直接调用它的封装函数实现,这是它库函数的[使用演示](./docs/demo.md)。
### 如何运行这个项目 ### 如何运行这个项目

84
docs/class.md → docs/demo.md

@ -1,6 +1,6 @@
## 库的调用 ## 库的调用
代码已封装为四个类 代码已封装为四个类,介绍如下
+ HRD_cal: 华容道快速计算器 + HRD_cal: 华容道快速计算器
@ -37,9 +37,10 @@ using namespace std;
int main() { int main() {
cout << "Klotski fast calculator by Dnomd343" << endl; cout << "Klotski fast calculator by Dnomd343" << endl;
cout << "----------------" << endl;
vector <unsigned long long> dat; vector <unsigned long long> dat;
HRD_cal demo; HRD_cal demo;
// 将编码转为文本(参数为unsigned long long 返回string类) // 将编码转为文本(参数为unsigned long long 返回string类)
cout << "4FEA13400 is " << demo.Change_str(0x4FEA13400) << endl; cout << "4FEA13400 is " << demo.Change_str(0x4FEA13400) << endl;
cout << "----------------" << endl; cout << "----------------" << endl;
@ -49,10 +50,14 @@ int main() {
cout << "----------------" << endl; cout << "----------------" << endl;
// 检测编码的正确性 // 检测编码的正确性
cout << "Check the code: 123456789 -> ";
if (demo.Check_Code(0x123456789) == false) { if (demo.Check_Code(0x123456789) == false) {
cout << "Code error!" << endl; cout << "Code error!" << endl;
} else {
cout << "No problem" << endl;
} }
cout << "----------------" << endl;
// 计算最少步数(参数为unsigned long long 返回vector类) // 计算最少步数(参数为unsigned long long 返回vector类)
dat = demo.Calculate(0x1A9BF0C00); dat = demo.Calculate(0x1A9BF0C00);
cout << demo.Change_str(0x1A9BF0C00) << "'s solution"; cout << demo.Change_str(0x1A9BF0C00) << "'s solution";
@ -88,6 +93,8 @@ int main() {
+ 检查编码是否合法 + 检查编码是否合法
+ 检测编码是否左右对称
+ 根据起始布局分析出层级结构,包括各层间的链接关系 + 根据起始布局分析出层级结构,包括各层间的链接关系
+ 得到布局的具体参数,包括全部最远布局、全部最少步解、全部合法解及其步数 + 得到布局的具体参数,包括全部最远布局、全部最少步解、全部合法解及其步数
@ -105,10 +112,28 @@ using namespace std;
int main() { int main() {
cout << "Klotski Analyser by Dnomd343" << endl; cout << "Klotski Analyser by Dnomd343" << endl;
cout << "---------------------------" << endl;
HRD_analy demo; HRD_analy demo;
// 判断编码是否左右对称
cout << "Check Mirror(code: 1A9BF0C00) -> ";
if (demo.Is_Mirror(0x1A9BF0C00)) {
cout << "yes" << endl;
} else {
cout << "no" << endl;
}
cout << "Check Mirror(code: 4FEA13400) -> ";
if (demo.Is_Mirror(0x4FEA13400)) {
cout << "yes" << endl;
} else {
cout << "no" << endl;
}
cout << "---------------------------" << endl;
// 显示编码的实际布局样式 // 显示编码的实际布局样式
cout << "Show 1A9BF0C00: " << endl;
demo.Output_Graph(0x1A9BF0C00, 4, 1, "&%"); demo.Output_Graph(0x1A9BF0C00, 4, 1, "&%");
cout << "---------------------------" << endl;
// 解译编码 // 解译编码
demo.Parse_Code(0x1A9BF0C00); demo.Parse_Code(0x1A9BF0C00);
@ -165,25 +190,36 @@ int main() {
cout << "---------------------------" << endl; cout << "---------------------------" << endl;
// 查看某布局的前后情况 // 查看某布局的前后情况
int layer_num = 29, layer_index = 190; int num = 29, index = 190;
// 得到全部父节点 cout << "Case near (num = " << num << ", index = " << index << ")" << endl;
for (int k = 0; k < (*(*demo.Layer[layer_num][layer_index]).adjacent).source_case.size(); k++) {
cout << " (" << (*(*(*demo.Layer[layer_num][layer_index]).adjacent).source_case[k]).layer_num; // 得到全部父节点数据
cout << "," << (*(*(*demo.Layer[layer_num][layer_index]).adjacent).source_case[k]).layer_index << "):"; for (int k = 0; k < demo.Layer[num][index]->source_case->size(); k++) {
cout << demo.Change_str((*(*(*demo.Layer[layer_num][layer_index]).adjacent).source_case[k]).code); cout << "(" << demo.Layer[num][index]->source_case->at(k)->layer_num;
cout << "," << demo.Layer[num][index]->source_case->at(k)->layer_index << ") = ";
cout << demo.Change_str(demo.Layer[num][index]->source_case->at(k)->code);
if (k + 1 != demo.Layer[num][index]->source_case->size()) {
cout << " / ";
}
} }
cout << " ->";
cout << " (" << layer_num << "," << layer_index << "):" << demo.Change_str((*demo.Layer[layer_num][layer_index]).code); // 得到本节点数据
cout << " ->"; cout << " -> ";
// 得到全部子节点 cout << "(" << num << "," << index << ") = " << demo.Change_str(demo.Layer[num][index]->code);
for (int k = 0; k < (*(*demo.Layer[layer_num][layer_index]).adjacent).next_case.size(); k++) { cout << " -> ";
cout << " (" << (*(*(*demo.Layer[layer_num][layer_index]).adjacent).next_case[k]).layer_num;
cout << "," << (*(*(*demo.Layer[layer_num][layer_index]).adjacent).next_case[k]).layer_index << "):"; // 得到全部子节点数据
cout << demo.Change_str((*(*(*demo.Layer[layer_num][layer_index]).adjacent).next_case[k]).code); for (int k = 0; k < demo.Layer[num][index]->next_case->size(); k++) {
cout << "(" << demo.Layer[num][index]->next_case->at(k)->layer_num;
cout << "," << demo.Layer[num][index]->next_case->at(k)->layer_index << ") = ";
cout << demo.Change_str(demo.Layer[num][index]->next_case->at(k)->code);
if (k + 1 != demo.Layer[num][index]->next_case->size()) {
cout << " / ";
}
} }
cout << endl; cout << endl;
cout << "---------------------------" << endl; cout << "---------------------------" << endl;
return 0; return 0;
} }
``` ```
@ -207,13 +243,16 @@ using namespace std;
int main() { int main() {
cout << "Klotski batch analyser by Dnomd343" << endl; cout << "Klotski batch analyser by Dnomd343" << endl;
cout << "---------------------------" << endl;
HRD_group demo; HRD_group demo;
// 计算群组中所有元素的具体参数并输出到文件(此处即计算1A9BF0C00所在群的数据) // 计算群组中所有元素的具体参数并输出到文件(此处即计算1A9BF0C00所在群的数据)
demo.Batch_Analyse(0x1A9BF0C00, "farthest.csv", "solution.csv", true); demo.Batch_Analyse(0x1A9BF0C00, "farthest.csv", "solution.csv", true);
cout << "---------------------------" << endl;
// 计算多个群组的分析信息,同时合并输出到文件(编码储存于5-4-0.txt中,最后一行切不可为空) // 计算多个群组的分析信息,同时合并输出到文件(编码储存于5-4-0.txt中,最后一行切不可为空)
demo.Multi_Analyse("5-4-0.txt", "farthest_5-4-0.csv", "solution_5-4-0.csv", true); demo.Multi_Analyse("5-4-0.txt", "farthest_5-4-0.csv", "solution_5-4-0.csv", true);
cout << "---------------------------" << endl;
return 0; return 0;
} }
@ -240,14 +279,17 @@ using namespace std;
int main() { int main() {
cout << "Klotski statistician by Dnomd343" << endl; cout << "Klotski statistician by Dnomd343" << endl;
cout << "---------------------------" << endl;
HRD_statistic demo; HRD_statistic demo;
// 找到全部合法的编码 // 找到全部合法的编码
demo.Find_All_Case("Output-All_Case.txt"); demo.Find_All_Case("Output-All_Case.txt");
cout << "---------------------------" << endl;
// 找到全部合法的编码并进行分类输出 // 找到全部合法的编码并进行分类输出
demo.All_Statistic(); demo.All_Statistic();
cout << "---------------------------" << endl;
return 0; return 0;
} }
``` ```

2
docs/group_num.md

@ -1,6 +1,6 @@
## 群的数量统计 ## 群的数量统计
| jiang_num | bing_num | style_num | 群的数量 | | jiang_num | bing_num | style_num | COUNT |
| :-: | :-: | :-: | :-: | | :-: | :-: | :-: | :-: |
| 0 | 0 | 0 | 1 | | 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 | | 0 | 1 | 0 | 1 |

36
docs/usage.md

@ -4,47 +4,47 @@
```bash ```bash
--show <code> [square_width] --show <code> [square_width]
Purpose: Visualize the <code> Purpose: Visualize the <code>
exp: ./engine --show 1A9BF0C00 eg: ./engine --show 1A9BF0C00
./engine --show 1A9BF0C00 4 ./engine --show 1A9BF0C00 5
``` ```
+ cal命令:计算输入布局的最少步解法 + cal命令:计算输入布局的最少步解法
```bash ```bash
--cal <code> [file_name] --cal <code> [file_name]
Purpose: Find the minimum step solution of <code> Purpose: Find the minimum step solution of <code>
exp: ./engine --cal 1A9BF0C00 eg: ./engine --cal 1A9BF0C00
./engine --cal 1A9BF0C00 demo.txt ./engine --cal 1A9BF0C00 demo.txt
``` ```
+ cal-target命令:计算两布局之间的最短路径 + cal-target命令:计算两布局之间的最短路径
```bash ```bash
--cal-target <code> <target> [file_name] --cal-target <code> <target> [file_name]
Purpose: Find the shortest path from <code> to <target> Purpose: Find the shortest path from <code> to <target>
exp: ./engine --cal-target 4FEA13400 43EA73400 eg: ./engine --cal-target 4FEA13400 43EA73400
./engine --cal-target 4FEA13400 43EA73400 demo.txt ./engine --cal-target 4FEA13400 43EA73400 demo.txt
``` ```
+ group命令:计算起始布局的所有衍生情况,即计算其所在群的全部元素 + group命令:计算起始布局的所有衍生情况,即计算其所在群的全部元素
```bash ```bash
--group <code> [file_name] --group <code> [file_name]
Purpose: Find all elements of the group where <code> located Purpose: Find all elements of the group where <code> located
exp: ./engine --group 4FEA13400 eg: ./engine --group 4FEA13400
./engine --group 4FEA13400 demo.txt ./engine --group 4FEA13400 demo.txt
``` ```
+ analy命令:分析布局的具体参数,包括层级结构,层间链接,解与最少步解,最远布局等 + analy命令:分析布局的具体参数,包括层级结构,层间链接,解与最少步解,最远布局等
```bash ```bash
--analy <code> [file_name] --analy <code> [file_name]
Purpose: Detailed analysis of the <code> Purpose: Detailed analysis of the <code>
exp: ./engine --analy 1A9BF0C00 eg: ./engine --analy 1A9BF0C00
./engine --analy 1A9BF0C00 demo.txt ./engine --analy 1A9BF0C00 demo.txt
``` ```
+ analy-quiet命令:同analy命令,但不输出计算过程 + analy-quiet命令:同analy命令,但不输出计算过程
```bash ```bash
--analy-quiet <code> <file_name> --analy-quiet <code> <file_name>
Purpose: The same function as --analy, but doesn't show the specific process Purpose: The same function as --analy, but doesn't show the specific process
exp: ./engine --analy-quiet 1A9BF0C00 demo.txt eg: ./engine --analy-quiet 1A9BF0C00 demo.txt
``` ```
+ analy-group命令:分析`code`衍生出的群中所有元素的具体参数,并输出到`最远布局信息`和`解的信息`两张csv表格中 + analy-group命令:分析`code`衍生出的群中所有元素的具体参数,并输出到`最远布局信息`和`解的信息`两张csv表格中
@ -53,14 +53,14 @@
<file_name_farthest>: As the output file of "farthest" <file_name_farthest>: As the output file of "farthest"
<file_name_solution>: As the output file of "solution" <file_name_solution>: As the output file of "solution"
Purpose: Analyze the whole group where <code> located Purpose: Analyze the whole group where <code> located
exp: ./engine --analy-group 1A9BF0C00 farthest.csv solution.csv eg: ./engine --analy-group 1A9BF0C00 farthest.csv solution.csv
``` ```
+ analy-group-integral命令:同analy-group命令,但`解的信息`中将会输出全部解的编码及步数 + analy-group-integral命令:同analy-group命令,但`解的信息`中将会输出全部解的编码及步数
```bash ```bash
--analy-group-integral <code> <file_name_farthest> <file_name_farthest> --analy-group-integral <code> <file_name_farthest> <file_name_farthest>
Purpose: The same function as --analy-group, but all solution case will be output Purpose: The same function as --analy-group, but all solution case will be output
exp: ./engine --analy-group-integral 1A9BF0C00 farthest.csv solution.csv eg: ./engine --analy-group-integral 1A9BF0C00 farthest.csv solution.csv
``` ```
+ analy-multi-group命令:多群组同时分析,相当于多次执行analy-group命令,结果合并输出到`最远布局信息`和`解的信息`两张csv表格中 + analy-multi-group命令:多群组同时分析,相当于多次执行analy-group命令,结果合并输出到`最远布局信息`和`解的信息`两张csv表格中
@ -70,35 +70,35 @@
<file_name_farthest>: As the output file of "farthest" <file_name_farthest>: As the output file of "farthest"
<file_name_farthest>: As the output file of "solution" <file_name_farthest>: As the output file of "solution"
Purpose: Analyze the whole group where each seed located Purpose: Analyze the whole group where each seed located
exp: ./engine --analy-multi-group 5-4-0.txt farthest.csv solution.csv eg: ./engine --analy-multi-group 5-4-0.txt farthest.csv solution.csv
``` ```
+ analy-multi-group-integral命令:同analy-multi-group命令,但`解的信息`中将会输出全部解的编码及步数 + analy-multi-group-integral命令:同analy-multi-group命令,但`解的信息`中将会输出全部解的编码及步数
```bash ```bash
--analy-multi-group-integral <input_file_name> <file_name_farthest> <file_name_farthest> --analy-multi-group-integral <input_file_name> <file_name_farthest> <file_name_farthest>
Purpose: The same function as --analy-multi-group, but all solution case will be output Purpose: The same function as --analy-multi-group, but all solution case will be output
exp: ./engine --analy-multi-group-integral 5-4-0.txt farthest.csv solution.csv eg: ./engine --analy-multi-group-integral 5-4-0.txt farthest.csv solution.csv
``` ```
+ all命令:找到所有可能的布局,同时得到其分类情况及群组关系,计算结果会输出到All_Case.txt(所有布局的编码),main.csv(所有布局的编码及其分类),\*-\*-\*.txt(各群组的第一个子布局集合) + all命令:找到所有可能的布局,同时得到其分类情况及群组关系,计算结果会输出到All_Case.txt(所有布局的编码),main.csv(所有布局的编码及其分类),\*-\*-\*.txt(各群组的第一个子布局集合)
```bash ```bash
--all --all
Purpose: Find all the cases of klotski with detail Purpose: Find all the cases of klotski with detail
exp: ./engine --all eg: ./engine --all
``` ```
+ all-code命令:简化版的all命令,仅输出全部布局的编码 + all-code命令:简化版的all命令,仅输出全部布局的编码
```bash ```bash
--all-code <file_name> --all-code <file_name>
Purpose: Find all the code of klotski Purpose: Find all the code of klotski
exp: ./engine --all-code All_Case.txt eg: ./engine --all-code All_Case.txt
``` ```
+ help命令:显示所有命令的使用方法 + help命令:显示所有命令的使用方法
```bash ```bash
--help --help
Purpose: Display instructions for use Purpose: Display instructions for use
exp: ./engine --help eg: ./engine --help
``` ```
## 编译 ## 编译

Loading…
Cancel
Save