0_0_39098307_32364\Main.java:1: 错误: 非法字符: '#'
#include <stdio.h>
^
0_0_39098307_32364\Main.java:1: 错误: 需要class, interface或enum
#include <stdio.h>
^
0_0_39098307_32364\Main.java:2: 错误: 非法字符: '#'
#include <stdlib.h>
^
0_0_39098307_32364\Main.java:4: 错误: 非法字符: '#'
#define MAX_SIZE 100 // 定义最大尺寸
^
0_0_39098307_32364\Main.java:9: 错误: 需要class, interface或enum
int y; // 节点的y坐标
^
0_0_39098307_32364\Main.java:10: 错误: 需要class, interface或enum
int f; // f值,f=g+h
^
0_0_39098307_32364\Main.java:11: 错误: 需要class, interface或enum
int g; // g值,从起点到当前节点的代价
^
0_0_39098307_32364\Main.java:12: 错误: 需要class, interface或enum
int h; // h值,从当前节点到终点的估计代价
^
0_0_39098307_32364\Main.java:13: 错误: 需要class, interface或enum
struct node* parent; // 父节点
^
0_0_39098307_32364\Main.java:14: 错误: 需要class, interface或enum
} Node;
^
0_0_39098307_32364\Main.java:16: 错误: 需要class, interface或enum
Node* openList[MAX_SIZE*MAX_SIZE]; // open列表,存放待检查的节点
^
0_0_39098307_32364\Main.java:17: 错误: 需要class, interface或enum
Node* closedList[MAX_SIZE*MAX_SIZE]; // closed列表,存放已检查的节点
^
0_0_39098307_32364\Main.java:18: 错误: 需要class, interface或enum
Node* nodes[MAX_SIZE][MAX_SIZE]; // 所有节点
^
0_0_39098307_32364\Main.java:19: 错误: 需要class, interface或enum
int openListSize = 0; // open列表的大小
^
0_0_39098307_32364\Main.java:20: 错误: 需要class, interface或enum
int closedListSize = 0; // closed列表的大小
^
0_0_39098307_32364\Main.java:23: 错误: 需要class, interface或enum
int startNodeX, startNodeY, endNodeX, endNodeY;
^
0_0_39098307_32364\Main.java:26: 错误: 需要class, interface或enum
int dx[4] = {-1, 1, 0, 0};
^
0_0_39098307_32364\Main.java:27: 错误: 需要class, interface或enum
int dy[4] = {0, 0, -1, 1};
^
0_0_39098307_32364\Main.java:30: 错误: 需要class, interface或enum
int map[MAX_SIZE][MAX_SIZE];
^
0_0_39098307_32364\Main.java:33: 错误: 需要class, interface或enum
void initNodes(int n, int m) {
^
0_0_39098307_32364\Main.java:34: 错误: 需要class, interface或enum
for(int i = 0; i < n; i++) {
^
0_0_39098307_32364\Main.java:34: 错误: 需要class, interface或enum
for(int i = 0; i < n; i++) {
^
0_0_39098307_32364\Main.java:35: 错误: 需要class, interface或enum
for(int j = 0; j < m; j++) {
^
0_0_39098307_32364\Main.java:35: 错误: 需要class, interface或enum
for(int j = 0; j < m; j++) {
^
0_0_39098307_32364\Main.java:37: 错误: 需要class, interface或enum
nodes[i][j]->x = i;
^
0_0_39098307_32364\Main.java:38: 错误: 需要class, interface或enum
nodes[i][j]->y = j;
^
0_0_39098307_32364\Main.java:39: 错误: 需要class, interface或enum
nodes[i][j]->f = 0;
^
0_0_39098307_32364\Main.java:40: 错误: 需要class, interface或enum
nodes[i][j]->g = 0;
^
0_0_39098307_32364\Main.java:41: 错误: 需要class, interface或enum
nodes[i][j]->h = abs(endNodeX-i) + abs(endNodeY-j); // 使用曼哈顿距离作为h值
^
0_0_39098307_32364\Main.java:42: 错误: 需要class, interface或enum
nodes[i][j]->parent = NULL;
^
0_0_39098307_32364\Main.java:43: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:50: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:54: 错误: 需要class, interface或enum
for(int i = 0; i < openListSize; i++) {
^
0_0_39098307_32364\Main.java:54: 错误: 需要class, interface或enum
for(int i = 0; i < openListSize; i++) {
^
0_0_39098307_32364\Main.java:57: 错误: 需要class, interface或enum
return;
^
0_0_39098307_32364\Main.java:58: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:64: 错误: 需要class, interface或enum
for(int i = 0; i < openListSize; i++) {
^
0_0_39098307_32364\Main.java:64: 错误: 需要class, interface或enum
for(int i = 0; i < openListSize; i++) {
^
0_0_39098307_32364\Main.java:67: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:70: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:75: 错误: 需要class, interface或enum
for(int i = 1; i < openListSize; i++) {
^
0_0_39098307_32364\Main.java:75: 错误: 需要class, interface或enum
for(int i = 1; i < openListSize; i++) {
^
0_0_39098307_32364\Main.java:75: 错误: 需要class, interface或enum
for(int i = 1; i < openListSize; i++) {
^
0_0_39098307_32364\Main.java:78: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:81: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:86: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:90: 错误: 需要class, interface或enum
for(int i = 0; i < closedListSize; i++) {
^
0_0_39098307_32364\Main.java:90: 错误: 需要class, interface或enum
for(int i = 0; i < closedListSize; i++) {
^
0_0_39098307_32364\Main.java:93: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:96: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:101: 错误: 需要class, interface或enum
addToOpenList(current); // 将起点加入open列表
^
0_0_39098307_32364\Main.java:102: 错误: 需要class, interface或enum
while(openListSize > 0) { // 当open列表不为空时
^
0_0_39098307_32364\Main.java:104: 错误: 需要class, interface或enum
if(current->x == endNodeX && current->y == endNodeY) { // 如果当前节点是终点
^
0_0_39098307_32364\Main.java:106: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:108: 错误: 需要class, interface或enum
addToClosedList(current); // 将当前节点加入closed列表
^
0_0_39098307_32364\Main.java:110: 错误: 需要class, interface或enum
for(int i = 0; i < 4; i++) {
^
0_0_39098307_32364\Main.java:110: 错误: 需要class, interface或enum
for(int i = 0; i < 4; i++) {
^
0_0_39098307_32364\Main.java:110: 错误: 需要class, interface或enum
for(int i = 0; i < 4; i++) {
^
0_0_39098307_32364\Main.java:112: 错误: 需要class, interface或enum
int ny = current->y + dy[i];
^
0_0_39098307_32364\Main.java:113: 错误: 需要class, interface或enum
if(nx >= 0 && ny >= 0 && nx < n && ny < m && map[nx][ny] != 1) { // 如果邻居节点在地图内且不是墙
^
0_0_39098307_32364\Main.java:115: 错误: 需要class, interface或enum
if(inClosedList(neighbor)) { // 如果邻居节点在closed列表中
^
0_0_39098307_32364\Main.java:117: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:119: 错误: 需要class, interface或enum
if(!inOpenList(neighbor) || g < neighbor->g) { // 如果邻居节点不在open列表中,或者新的路径到邻居节点的代价更低
^
0_0_39098307_32364\Main.java:121: 错误: 需要class, interface或enum
neighbor->g = g; // 更新邻居节点的g值
^
0_0_39098307_32364\Main.java:122: 错误: 需要class, interface或enum
neighbor->f = g + neighbor->h; // 更新邻居节点的f值
^
0_0_39098307_32364\Main.java:123: 错误: 需要class, interface或enum
if(!inOpenList(neighbor)) { // 如果邻居节点不在open列表中
^
0_0_39098307_32364\Main.java:125: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:135: 错误: 需要class, interface或enum
while(current != NULL) { // 当还有父节点时
^
0_0_39098307_32364\Main.java:137: 错误: 需要class, interface或enum
current = current->parent; // 移动到父节点
^
0_0_39098307_32364\Main.java:138: 错误: 需要class, interface或enum
}
^
0_0_39098307_32364\Main.java:143: 错误: 需要class, interface或enum
printf("输入图的大小 (n m): ");
^
0_0_39098307_32364\Main.java:144: 错误: 需要class, interface或enum
scanf("%d %d", &n, &m);
^
0_0_39098307_32364\Main.java:146: 错误: 需要class, interface或enum
printf("输入起点 (x y): ");
^
0_0_39098307_32364\Main.java:147: 错误: 需要class, interface或enum
scanf("%d %d", &startNodeX, &startNodeY);
^
0_0_39098307_32364\Main.java:149: 错误: 需要class, interface或enum
printf("输入终点 (x y): ");
^
0_0_39098307_32364\Main.java:150: 错误: 需要class, interface或enum
scanf("%d %d", &endNodeX, &endNodeY);
^
0_0_39098307_32364\Main.java:152: 错误: 需要class, interface或enum
printf("输入图 (0 为可通过路径, 1 为墙):\n");
^
0_0_39098307_32364\Main.java:153: 错误: 需要class, interface或enum
for(int i = 0; i < n; i++) {
^
0_0_39098307_32364\Main.java:153: 错误: 需要class, interface或enum
for(int i = 0; i < n; i++) {
^
0_0_39098307_32364\Main.java:153: 错误: 需要class, interface或enum
for(int i = 0; i < n; i++) {
^
0_0_39098307_32364\Main.java:154: 错误: 需要class, interface或enu
|