Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

Revision:
16:4a20536c9bb8
Parent:
15:32b5d97a4281
--- a/pathfinding.cpp	Wed Mar 01 15:18:50 2017 +0000
+++ b/pathfinding.cpp	Wed Mar 01 19:49:49 2017 +0000
@@ -23,8 +23,8 @@
 #include <stdio.h>
 #include <iostream>
 
-#define row 10
-#define col 10
+#define row 100
+#define col 100
 
 
 using namespace std;
@@ -47,13 +47,17 @@
 Main a_star handling
 ************************************************************************************************************/
 void pathfinding() {
-
+    define_obst();
     position start = { 1,1 };   //start
-    position target = { 8,8 };  //target
+    position target = { 198,198 };  //target
     position current = { 0 };   //current pos
 
-    //memset(open_list, 0, sizeof(open_list));
-
+    memset(open_list, 0, sizeof(open_list));
+    memset(g_list, 0, sizeof(g_list));
+    memset(walkpath, 0, sizeof(walkpath));
+    open_list_count = 0;
+    counter = 0;
+    
     // check if position is reachable
     if (obstacle_list[start.x][start.y] == 1 || start.x > row || start.y > col ||
         obstacle_list[target.x][target.y] == 1 || target.x > row || target.y > col) { 
@@ -100,7 +104,7 @@
 /************************************************************************************************************
 only needed for test, will be done by mapping function, delete for use on robot
 ************************************************************************************************************/
-void define_obst() {
+static void define_obst() {
 
     for (int i = 0; i < row; i++) {
         obstacle_list[i][0] = 1;
@@ -136,7 +140,7 @@
 /************************************************************************************************************
 Essential function for calculating the distance
 ************************************************************************************************************/
-void calc_F(position a, position b, position current) {
+static void calc_F(position a, position b, position current) {
 
     position adjacent = current;
     position corner1 = { 0 }, corner2 = { 0 };
@@ -202,7 +206,7 @@
 /************************************************************************************************************
 Essential function for getting the next position
 ************************************************************************************************************/
-position openList_lowest_F() {
+static position openList_lowest_F() {
     uint16_t lowest = row * col;
     position lowest_pos;
     for (uint8_t i = 0; i < row; i++) {
@@ -220,7 +224,7 @@
 /************************************************************************************************************
 Essential function for getting the next position
 ************************************************************************************************************/
-void mapp_path(position b) {
+static void mapp_path(position b) {
     // write path to walkpath array
 
     position x = b; // lower value