mirror of
https://gitee.com/yyz_o/bk_bishe_pi.git
synced 2025-09-07 23:21:26 +00:00
25.5.29第二次提交
This commit is contained in:
@@ -26,11 +26,14 @@ int main()
|
||||
array_copy_wall(mazesize_x, mazesize_y, copy_wall); //复制一份wall数组,并转换为一维数组,便于后续频繁读取提升性能
|
||||
|
||||
cout << "访问数组打印:" << endl;
|
||||
cout << endl;
|
||||
output_arr2D(mazesize_x, mazesize_y, copy_mark); //打印地图mark信息
|
||||
cout << "地图打印:" << endl;
|
||||
cout << endl;
|
||||
output_arrwall(mazesize_x, mazesize_y, copy_wall); //打印墙壁wall信息
|
||||
|
||||
cout << "请输入目标点的X,Y坐标值 用空格隔开并回车" << endl;
|
||||
cout << endl;
|
||||
cin >> target_x >> target_y;
|
||||
cout << endl;
|
||||
|
||||
@@ -39,6 +42,7 @@ int main()
|
||||
|
||||
flood(map, copy_wall); //洪水填充算法
|
||||
cout << "路径打印:" << endl;
|
||||
cout << endl;
|
||||
output_arr2D(mazesize_x, mazesize_y, map); //打印map的数组信息
|
||||
|
||||
const int len = map[((target_x - 1) * mazesize_y) + (target_y -1)]; //迷宫的终点(人为确定)
|
||||
@@ -47,6 +51,7 @@ int main()
|
||||
build_path(target_x - 1, target_y - 1, len, path, map, copy_wall); //构建出最短路径path数组
|
||||
|
||||
cout << "移动指令打印:" << endl;
|
||||
cout << endl;
|
||||
output_arrpath(len, path); //打印path数组信息,及小车每一步的行驶方向
|
||||
|
||||
drive_path(len, path); //移动到指定目标点
|
||||
|
||||
Reference in New Issue
Block a user