Browse Source

update readme

master
Dnomd343 4 years ago
parent
commit
e046a22b5c
  1. 198
      README.md

198
README.md

@ -1,3 +1,130 @@
## 命令行参数
+ show命令:根据编码输出实际布局样式
```bash
--show <code> [square_width]
Purpose: Visualize the <code>
exp: ./engine --show 1A9BF0C00
./engine --show 1A9BF0C00 4
```
+ cal命令:计算输入布局的最少步解法
```bash
--cal <code> [file_name]
Purpose: Find the minimum step solution of <code>
exp: ./engine --cal 1A9BF0C00
./engine --cal 1A9BF0C00 demo.txt
```
+ cal-target命令:计算两布局之间的最短路径
```bash
--cal-target <code> <target> [file_name]
Purpose: Find the shortest path from <code> to <target>
exp: ./engine --cal-target 4FEA13400 43EA73400
./engine --cal-target 4FEA13400 43EA73400 demo.txt
```
+ group命令:计算起始布局的所有衍生情况,即计算其所在群的全部元素
```bash
--group <code> [file_name]
Purpose: Find all elements of the group where <code> located
exp: ./engine --group 4FEA13400
./engine --group 4FEA13400 demo.txt
```
+ analy命令:分析布局的具体参数,包括层级结构,层间链接,解与最少步解,最远布局等
```bash
--analy <code> [file_name]
Purpose: Detailed analysis of the <code>
exp: ./engine --analy 1A9BF0C00
./engine --analy 1A9BF0C00 demo.txt
```
+ analy-quiet命令:同analy命令,但不输出计算过程
```bash
--analy-quiet <code> <file_name>
Purpose: The same function as --analy, but doesn't show the specific process
exp: ./engine --analy-quiet 1A9BF0C00 demo.txt
```
+ analy-group命令:分析`code`衍生出的群中所有元素的具体参数,并输出到`最远布局信息`和`解的信息`两张csv表格中
```bash
--analy-group <code> <file_name_farthest> <file_name_solution>
<file_name_farthest>: As the output file of "farthest"
<file_name_solution>: As the output file of "solution"
Purpose: Analyze the whole group where <code> located
exp: ./engine --analy-group 1A9BF0C00 farthest.csv solution.csv
```
+ analy-group-integral命令:同analy-group命令,但`解的信息`中将会输出全部解的编码及步数
```bash
--analy-group-integral <code> <file_name_farthest> <file_name_farthest>
Purpose: The same function as --analy-group, but all solution case will be output
exp: ./engine --analy-group-integral 1A9BF0C00 farthest.csv solution.csv
```
+ analy-multi-group命令:多群组同时分析,相当于多次执行analy-group命令,结果合并输出到`最远布局信息`和`解的信息`两张csv表格中
```bash
--analy-multi-group <input_file_name> <file_name_farthest> <file_name_farthest>
<input_file_name>: As the input file of seeds
<file_name_farthest>: As the output file of "farthest"
<file_name_farthest>: As the output file of "solution"
Purpose: Analyze the whole group where each seed located
exp: ./engine --analy-multi-group 5-4-0.txt farthest.csv solution.csv
```
+ analy-multi-group-integral命令:同analy-multi-group命令,但`解的信息`中将会输出全部解的编码及步数
```bash
--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
exp: ./engine --analy-multi-group-integral 5-4-0.txt farthest.csv solution.csv
```
+ all命令:找到所有可能的布局,同时得到其分类情况及群组关系,计算结果会输出到All_Case.txt(所有布局的编码),main.csv(所有布局的编码及其分类),\*-\*-\*.txt(各群组的第一个子布局集合)
```bash
--all
Purpose: Find all the cases of klotski with detail
exp: ./engine --all
```
+ all-code命令:简化版的all命令,仅输出全部布局的编码
```bash
--all-code <file_name>
Purpose: Find all the code of klotski
exp: ./engine --all-code All_Case.txt
```
+ help命令:显示所有命令的使用方法
```bash
--help
Purpose: Display instructions for use
exp: ./engine --help
```
## 编译
+ Windows下,要求计算机有mingw环境或其他C/C++编译器
+ Linux下,要求计算机有gcc编译器
+ Android下,可以在termux中安装clang编译器
编译指令
```bash
g++.exe -O3 -c ./src/engine/HRD_analy.cpp -o ./src/engine/HRD_analy.o
g++.exe -O3 -c ./src/engine/HRD_cal.cpp -o ./src/engine/HRD_cal.o
g++.exe -O3 -c ./src/engine/HRD_group.cpp -o ./src/engine/HRD_group.o
g++.exe -O3 -c ./src/engine/HRD_statistic.cpp -o ./src/engine/HRD_statistic.o
g++.exe -O3 -c ./src/engine/main.cpp -o ./src/engine/main.o
g++.exe -o ./engine.exe ./src/engine/HRD_analy.o ./src/engine/HRD_cal.o ./src/engine/HRD_group.o ./src/engine/HRD_statistic.o ./src/engine/main.o
```
或直接使用
```bash
g++ -O3 ./src/engine/*.cpp -o ./engine
```
## 库的调用
### HRD_cal
@ -94,6 +221,9 @@ int main() {
cout << "Klotski Analyser by Dnomd343" << endl;
HRD_analy demo;
// 显示编码的实际布局样式
demo.Output_Graph(0x1A9BF0C00, 4, 1, "&%");
// 解译编码
demo.Parse_Code(0x1A9BF0C00);
cout << "code: " << demo.Change_str(demo.Parse_dat.code) << endl;
@ -172,6 +302,70 @@ int main() {
}
```
### HRD_group
描述:华容道群组批量分析器
+ 搜索某一群组全部元素的具体参数(输入群组中任一布局编码)
+ 排列分析多个群组(输入储存种子编码的文件名)
使用:包含头文件"HRD_group.h",类名为HRD_group(依赖HRD_cal);
示例:
```c++
#include <iostream>
#include "HRD_group.h"
using namespace std;
int main() {
cout << "Klotski batch analyser by Dnomd343" << endl;
HRD_group demo;
// 计算群组中所有元素的具体参数并输出到文件(此处即计算1A9BF0C00所在群的数据)
demo.Batch_Analyse(0x1A9BF0C00, "farthest.csv", "solution.csv", true);
// 计算多个群组的分析信息,同时合并输出到文件(编码储存于5-4-0.txt中,最后一行切不可为空)
demo.Multi_Analyse("5-4-0.txt", "farthest_5-4-0.csv", "solution_5-4-0.csv", true);
return 0;
}
```
### HRD_statistic
描述:华容道统计器
+ 搜索全部合法的华容道布局编码
+ 计算搜索到编码分类,即各布局的jiang_num-bing_num-style_num-group_num-group_index信息
+ 取各群组的种子编码输出到文件
使用:包含头文件"HRD_statistic.h",类名为HRD_statistic(依赖HRD_cal与HRD_analy);
示例:
```c++
#include <iostream>
#include "HRD_statistic.h"
using namespace std;
int main() {
cout << "Klotski statistician by Dnomd343" << endl;
HRD_statistic demo;
// 找到全部合法的编码
demo.Find_All_Case("Output-All_Case.txt");
// 找到全部合法的编码并进行分类输出
demo.All_Statistic();
return 0;
}
```
## 基本定义
@ -261,8 +455,8 @@ int main() {
| 棋子类型 | 代号 |
| :-: | :-: |
| 空格 | 00 |
| 1 x 2 | 01 |
| 2 x 1 | 10 |
| 2 x 1 | 01 |
| 1 x 2 | 10 |
| 1 x 1 | 11 |
十六进制可按位转为二进制,对应关系如下:

Loading…
Cancel
Save