Tobis Programm forked to not destroy your golden files
Fork of Robocode by
Diff: source/Pathfinding.cpp
- Revision:
- 132:8ae08f41bb43
- Parent:
- 130:670a954495bf
--- a/source/Pathfinding.cpp Mon May 15 13:03:16 2017 +0000 +++ b/source/Pathfinding.cpp Mon May 15 14:58:27 2017 +0000 @@ -80,7 +80,6 @@ g_list[target.x][target.y] = 1; do { - current = openList_lowest_F(); // Get the square with the lowest F score open_list[current.x][current.y] = 65535; // add position to the closed list; open_list 1111 1111 1111 1111 ^= closed_list = 1 open_list_count -= 1; @@ -90,14 +89,14 @@ break; // break the loop } calc_F(target, start, current); // Calculates F for each neighbour of current lowest F - } while (!(open_list_count == 0)); // Continue until there is no more available square in the open list (which means there is no path) + if (open_list[start.x][start.y] != 65535) { // if we added the destination to the closed list, we've found a path // no path found printf("No Path possible, line 97\r\n"); print_map(0); - print_map(1); print_map(2); + print_map(3); return no_path_possible; } else { // path found @@ -240,7 +239,7 @@ position y = b; // higher value counter = 0; walkpath[0] = y; - printf("(%d | %d) \n", walkpath[0].x, walkpath[0].y); + printf("(%d | %d) \r\n", walkpath[0].x, walkpath[0].y); while (g_list[y.x][y.y] > 1) { counter += 1; position s = b; @@ -289,8 +288,8 @@ y = s; walkpath[counter].x = y.x; walkpath[counter].y = y.y; - printf("(%d | %d) \n", walkpath[counter].x, walkpath[counter].y); - + printf("(%d | %d) \r\n", walkpath[counter].x, walkpath[counter].y); + } } @@ -311,6 +310,7 @@ if(list == 0)printf("%d ", obstacle_list[y][x]); if(list == 1)printf("%d ", open_list[y][x]); if(list == 2)printf("%d ", target_list[y][x]); + if(list == 3)printf("%d ", g_list[y][x]); } printf("\r\n"); }