25.5.29第二次提交

This commit is contained in:
Ñõԭ×Ó
2025-05-29 12:11:35 +08:00
parent efa0d49694
commit 9ba913646c
3 changed files with 12 additions and 5 deletions

View File

@@ -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); //移动到指定目标点