[Orxonox-commit 7745] r12338 - code/branches/3DPacman_FS19/src/modules/pacman

peterf at orxonox.net peterf at orxonox.net
Fri May 3 11:23:16 CEST 2019


Author: peterf
Date: 2019-05-03 11:23:15 +0200 (Fri, 03 May 2019)
New Revision: 12338

Removed:
   code/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.cc
Modified:
   code/branches/3DPacman_FS19/src/modules/pacman/Pacman.cc
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
Log:
Pink Bug Workaround

Modified: code/branches/3DPacman_FS19/src/modules/pacman/Pacman.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/Pacman.cc	2019-05-02 14:40:50 UTC (rev 12337)
+++ code/branches/3DPacman_FS19/src/modules/pacman/Pacman.cc	2019-05-03 09:23:15 UTC (rev 12338)
@@ -139,7 +139,7 @@
 
     //Check for collisions between to objects (compare float numbers)
     bool Pacman::collis(Vector3 one, Vector3 other){
-        if((abs(one.x-other.x)<10) && (abs(one.y-other.y)<10) && (abs(one.z-other.z)<10))
+        if((abs(one.x-other.x)<19) && (abs(one.y-other.y)<10) && (abs(one.z-other.z)<19))
             return true;
         return false;
     }

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	2019-05-02 14:40:50 UTC (rev 12337)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	2019-05-03 09:23:15 UTC (rev 12338)
@@ -150,320 +150,5 @@
 
 
 
-        /*void PacmanBrown::findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]){      
-            //this function should put in adjacentPosition[] the neighboors of lastPlayerPastPoint
-
-            if(findpos(actuelposition,possibleposition[0])){
-                
-
-                adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]);  //need to do it everywhere !!!
-                adjacentPositions[1]=positionArray[17]; //graphVertex(possibleposition[17]);
-                adjacentPositions[2]=positionArray[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ?
-            }
-            else if(findpos(actuelposition,possibleposition[1])){
-                adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
-                adjacentPositions[1]=positionArray[2]; //graphVertex(possibleposition[2]);
-            }
-            else if(findpos(actuelposition,possibleposition[2])){
-                adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]);
-                adjacentPositions[1]=positionArray[3]; //graphVertex(possibleposition[3]);
-            }
-            else if(findpos(actuelposition,possibleposition[3])){
-                adjacentPositions[0]=positionArray[2]; //graphVertex(possibleposition[2]);
-                adjacentPositions[1]=positionArray[4]; //graphVertex(possibleposition[4]);
-                adjacentPositions[2]=positionArray[5]; //graphVertex(possibleposition[5]);
-            }
-            else if(findpos(actuelposition,possibleposition[4])){
-                adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);
-                adjacentPositions[1]=positionArray[6]; //graphVertex(possibleposition[6]);
-            }
-            else if(findpos(actuelposition,possibleposition[5])){
-                adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);
-                adjacentPositions[1]=positionArray[7]; //graphVertex(possibleposition[7]);
-            }
-            else if(findpos(actuelposition,possibleposition[6])){
-                adjacentPositions[0]=positionArray[4]; //graphVertex(possibleposition[4]);
-                adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);
-                adjacentPositions[2]=positionArray[26]; //graphVertex(possibleposition[26]);
-            }
-            else if(findpos(actuelposition,possibleposition[7])){
-                adjacentPositions[0]=positionArray[5]; //graphVertex(possibleposition[5]);
-                adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);
-            }
-            else if(findpos(actuelposition,possibleposition[8])){
-                adjacentPositions[0]=positionArray[7]; //graphVertex(possibleposition[7]);
-                adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);
-            }
-            else if(findpos(actuelposition,possibleposition[9])){
-                adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);
-                adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);
-                adjacentPositions[2]=positionArray[10]; //graphVertex(possibleposition[10]);
-                adjacentPositions[3]=positionArray[38]; //graphVertex(possibleposition[38]);
-            }
-            else if(findpos(actuelposition,possibleposition[10])){
-                adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);
-                adjacentPositions[1]=positionArray[11]; //graphVertex(possibleposition[11]);
-                adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);
-            }
-            else if(findpos(actuelposition,possibleposition[11])){
-                adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);
-                adjacentPositions[1]=positionArray[12]; //graphVertex(possibleposition[12]);
-                adjacentPositions[2]=positionArray[13]; //graphVertex(possibleposition[13]);
-            }
-            else if(findpos(actuelposition,possibleposition[12])){
-                adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);
-                adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);
-            }
-            else if(findpos(actuelposition,possibleposition[13])){
-                adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);
-                adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);
-                adjacentPositions[2]=positionArray[16]; //graphVertex(possibleposition[16]);
-                adjacentPositions[3]=positionArray[61]; //graphVertex(possibleposition[61]);
-            }
-            else if(findpos(actuelposition,possibleposition[14])){
-                adjacentPositions[0]=positionArray[12]; //graphVertex(possibleposition[12]);
-                adjacentPositions[1]=positionArray[13]; //graphVertex(possibleposition[13]);
-                adjacentPositions[2]=positionArray[15]; //graphVertex(possibleposition[15]);
-            }
-            else if(findpos(actuelposition,possibleposition[15])){
-                adjacentPositions[0]=positionArray[14]; //graphVertex(possibleposition[14]);
-                adjacentPositions[1]=positionArray[16]; //graphVertex(possibleposition[16]);
-            }
-            else if(findpos(actuelposition,possibleposition[16])){
-                adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);
-                adjacentPositions[1]=positionArray[15]; //graphVertex(possibleposition[15]);
-                adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);
-            }
-            else if(findpos(actuelposition,possibleposition[17])){
-                adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
-                adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);
-            }
-            else if(findpos(actuelposition,possibleposition[18])){
-                adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);
-                adjacentPositions[1]=positionArray[24]; //graphVertex(possibleposition[24]);                
-            }
-            else if(findpos(actuelposition,possibleposition[19])){
-                adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
-                adjacentPositions[1]=positionArray[18]; //graphVertex(possibleposition[18]);
-                adjacentPositions[2]=positionArray[20]; //graphVertex(possibleposition[20]);
-                         }
-            else if(findpos(actuelposition,possibleposition[20])){
-                adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);
-                adjacentPositions[1]=positionArray[21]; //graphVertex(possibleposition[21]);
-                       }
-            else if(findpos(actuelposition,possibleposition[21])){
-                adjacentPositions[0]=positionArray[20]; //graphVertex(possibleposition[20]);
-                adjacentPositions[1]=positionArray[22]; //graphVertex(possibleposition[22]);
-                       }
-            else if(findpos(actuelposition,possibleposition[22])){
-                adjacentPositions[0]=positionArray[21]; //graphVertex(possibleposition[21]);
-                adjacentPositions[1]=positionArray[23]; //graphVertex(possibleposition[23]);
-                adjacentPositions[2]=positionArray[31]; //graphVertex(possibleposition[31]);
-                          }
-            else if(findpos(actuelposition,possibleposition[23])){
-                adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);
-                adjacentPositions[1]=positionArray[30]; //graphVertex(possibleposition[30]);
-                       }
-            else if(findpos(actuelposition,possibleposition[24])){
-                adjacentPositions[0]=positionArray[18]; //graphVertex(possibleposition[18]);
-                adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
-                       }
-            else if(findpos(actuelposition,possibleposition[25])){
-                adjacentPositions[0]=positionArray[17]; //graphVertex(possibleposition[17]);
-                adjacentPositions[1]=positionArray[26]; //graphVertex(possibleposition[26]);
-                       }
-            else if(findpos(actuelposition,possibleposition[26])){
-                adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);
-                adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);
-                adjacentPositions[2]=positionArray[27]; //graphVertex(possibleposition[27]);
-                         }
-            else if(findpos(actuelposition,possibleposition[27])){
-                adjacentPositions[0]=positionArray[26]; //graphVertex(possibleposition[26]);
-                adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);
-                adjacentPositions[2]=positionArray[37]; //graphVertex(possibleposition[37]);
-                          }
-            else if(findpos(actuelposition,possibleposition[28])){
-                adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);
-                adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
-                adjacentPositions[2]=positionArray[36]; //graphVertex(possibleposition[36]);
-                          }
-            else if(findpos(actuelposition,possibleposition[29])){
-                adjacentPositions[0]=positionArray[24]; //graphVertex(possibleposition[24]);
-                adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);
-                adjacentPositions[2]=positionArray[30]; //graphVertex(possibleposition[30]);
-                          }
-            else if(findpos(actuelposition,possibleposition[30])){
-                adjacentPositions[0]=positionArray[23]; //graphVertex(possibleposition[23]);
-                adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
-                adjacentPositions[2]=positionArray[34]; //graphVertex(possibleposition[34]);
-                          }
-            else if(findpos(actuelposition,possibleposition[31])){
-                adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);
-                adjacentPositions[1]=positionArray[32]; //graphVertex(possibleposition[32]);
-                       }
-            else if(findpos(actuelposition,possibleposition[32])){
-                adjacentPositions[0]=positionArray[31]; //graphVertex(possibleposition[31]);
-                adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);
-                       }
-            else if(findpos(actuelposition,possibleposition[33])){
-                adjacentPositions[0]=positionArray[32]; //graphVertex(possibleposition[32]);
-                adjacentPositions[1]=positionArray[34]; //graphVertex(possibleposition[34]);
-                       }
-            else if(findpos(actuelposition,possibleposition[34])){
-                adjacentPositions[0]=positionArray[30]; //graphVertex(possibleposition[30]);
-                adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);
-                adjacentPositions[2]=positionArray[35]; //graphVertex(possibleposition[35]);
-                adjacentPositions[3]=positionArray[42]; //graphVertex(possibleposition[42]);
-                
-            }
-            else if(findpos(actuelposition,possibleposition[35])){
-                adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);
-                adjacentPositions[1]=positionArray[36]; //graphVertex(possibleposition[36]);
-                adjacentPositions[2]=positionArray[41]; //graphVertex(possibleposition[41]);
-                          }
-            else if(findpos(actuelposition,possibleposition[36])){
-                adjacentPositions[0]=positionArray[28]; //graphVertex(possibleposition[28]);
-                adjacentPositions[1]=positionArray[35]; //graphVertex(possibleposition[35]);
-                       }
-            else if(findpos(actuelposition,possibleposition[37])){
-                adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);
-                adjacentPositions[1]=positionArray[38]; //graphVertex(possibleposition[38]);
-                       }
-            else if(findpos(actuelposition,possibleposition[38])){
-                adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);
-                adjacentPositions[1]=positionArray[37]; //graphVertex(possibleposition[37]);
-                adjacentPositions[2]=positionArray[39]; //graphVertex(possibleposition[39]);
-                         }
-            else if(findpos(actuelposition,possibleposition[39])){
-                adjacentPositions[0]=positionArray[38]; //graphVertex(possibleposition[38]);
-                adjacentPositions[1]=positionArray[40]; //graphVertex(possibleposition[40]);
-                adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);
-                          }
-            else if(findpos(actuelposition,possibleposition[40])){
-                adjacentPositions[0]=positionArray[39]; //graphVertex(possibleposition[39]);
-                adjacentPositions[1]=positionArray[41]; //graphVertex(possibleposition[41]);
-            }
-            else if(findpos(actuelposition,possibleposition[41])){
-                adjacentPositions[0]=positionArray[35]; //graphVertex(possibleposition[35]);
-                adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);
-                       }
-            else if(findpos(actuelposition,possibleposition[42])){
-                adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);
-                adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);
-                adjacentPositions[2]=positionArray[54]; //graphVertex(possibleposition[54]);
-                          }
-            else if(findpos(actuelposition,possibleposition[43])){
-                adjacentPositions[0]=positionArray[41]; //graphVertex(possibleposition[41]);
-                adjacentPositions[1]=positionArray[46]; //graphVertex(possibleposition[46]);
-                       }
-            else if(findpos(actuelposition,possibleposition[44])){
-                adjacentPositions[0]=positionArray[40]; //graphVertex(possibleposition[40]);
-                adjacentPositions[1]=positionArray[66]; //graphVertex(possibleposition[66]);
-                       }
-            else if(findpos(actuelposition,possibleposition[45])){
-                adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);
-                adjacentPositions[1]=positionArray[39]; //graphVertex(possibleposition[39]);
-                adjacentPositions[2]=positionArray[49]; //graphVertex(possibleposition[49]);
-                          }
-            else if(findpos(actuelposition,possibleposition[46])){
-                adjacentPositions[0]=positionArray[43]; //graphVertex(possibleposition[43]);
-                adjacentPositions[1]=positionArray[47]; //graphVertex(possibleposition[47]);
-                       }
-            else if(findpos(actuelposition,possibleposition[47])){
-                adjacentPositions[0]=positionArray[46]; //graphVertex(possibleposition[46]);
-                adjacentPositions[1]=positionArray[52]; //graphVertex(possibleposition[52]);
-                adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);
-                          }
-            else if(findpos(actuelposition,possibleposition[48])){
-                adjacentPositions[0]=positionArray[49]; //graphVertex(possibleposition[49]);
-                adjacentPositions[1]=positionArray[51]; //graphVertex(possibleposition[51]);
-                adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);
-                          }
-            else if(findpos(actuelposition,possibleposition[49])){
-                adjacentPositions[0]=positionArray[45]; //graphVertex(possibleposition[45]);
-                adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);
-                       }
-            else if(findpos(actuelposition,possibleposition[50])){
-                adjacentPositions[0]=positionArray[51]; //graphVertex(possibleposition[51]);
-                adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);
-                       }
-            else if(findpos(actuelposition,possibleposition[51])){
-                adjacentPositions[0]=positionArray[48]; //graphVertex(possibleposition[48]);
-                adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);
-                       }
-            else if(findpos(actuelposition,possibleposition[52])){
-                adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);
-                adjacentPositions[1]=positionArray[53]; //graphVertex(possibleposition[53]);
-                       }
-            else if(findpos(actuelposition,possibleposition[53])){
-                adjacentPositions[0]=positionArray[52]; //graphVertex(possibleposition[52]);
-                adjacentPositions[1]=positionArray[58]; //graphVertex(possibleposition[58]);
-                       }
-            else if(findpos(actuelposition,possibleposition[54])){
-                adjacentPositions[0]=positionArray[42]; //graphVertex(possibleposition[42]);
-                adjacentPositions[1]=positionArray[55]; //graphVertex(possibleposition[55]);
-                adjacentPositions[2]=positionArray[57]; //graphVertex(possibleposition[57]);
-                          }
-            else if(findpos(actuelposition,possibleposition[55])){
-                adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);
-                adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);
-                       }
-            else if(findpos(actuelposition,possibleposition[56])){
-                adjacentPositions[0]=positionArray[55]; //graphVertex(possibleposition[55]);
-                adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);
-                adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);
-                          }
-            else if(findpos(actuelposition,possibleposition[57])){
-                adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);
-                adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);
-                adjacentPositions[2]=positionArray[58]; //graphVertex(possibleposition[58]);
-                adjacentPositions[3]=positionArray[64]; //graphVertex(possibleposition[64]);
-                
-            }
-            else if(findpos(actuelposition,possibleposition[58])){
-                adjacentPositions[0]=positionArray[53]; //graphVertex(possibleposition[53]);
-                adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);
-                adjacentPositions[2]=positionArray[59]; //graphVertex(possibleposition[59]);
-                          }
-            else if(findpos(actuelposition,possibleposition[59])){
-                adjacentPositions[0]=positionArray[58]; //graphVertex(possibleposition[58]);
-                adjacentPositions[1]=positionArray[59]; //graphVertex(possibleposition[59]);
-                adjacentPositions[2]=positionArray[63]; //graphVertex(possibleposition[63]);
-                          }
-            else if(findpos(actuelposition,possibleposition[60])){
-                adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);
-                adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);
-                adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);
-                          }
-            else if(findpos(actuelposition,possibleposition[61])){
-                adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);
-                adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);
-                adjacentPositions[2]=positionArray[60]; //graphVertex(possibleposition[60]);
-                          }
-            else if(findpos(actuelposition,possibleposition[62])){
-                adjacentPositions[0]=positionArray[16]; //graphVertex(possibleposition[16]);
-                adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]);
-                       }
-            else if(findpos(actuelposition,possibleposition[63])){
-                adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);
-                adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);
-                       }
-            else if(findpos(actuelposition,possibleposition[64])){
-                adjacentPositions[0]=positionArray[57]; //graphVertex(possibleposition[57]);
-                adjacentPositions[1]=positionArray[63]; //graphVertex(possibleposition[63]);
-                adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);
-                          }
-            else if(findpos(actuelposition,possibleposition[65])){
-                adjacentPositions[0]=positionArray[56]; //graphVertex(possibleposition[56]);
-                adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);
-                       }
-            else if(findpos(actuelposition,possibleposition[66])){
-                adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);
-                adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);
-                       }
-    }*/
-
-
-
 }
 

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-05-02 14:40:50 UTC (rev 12337)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-05-03 09:23:15 UTC (rev 12338)
@@ -31,1526 +31,1075 @@
 #include "core/CoreIncludes.h"
 #include "BulletDynamics/Dynamics/btRigidBody.h"
 
+#include <vector>
+
 namespace orxonox
 {
 
 
-    struct PacmanGhost::graphVertex {
+	struct PacmanGhost::graphVertex {
 
-        public:
+		public:
 
-            Vector3 position;
-            graphVertex *adjacentVertices[4]; //neighbooring vertices
+			Vector3 position;
+			graphVertex *adjacentVertices[4]; //neighbooring vertices
 
-            //would a vector of vector storing the neighboors not be more suitable ?
+			//would a vector of vector storing the neighboors not be more suitable ?
 
-            int shortestDistanceToStart; //actual shortest distance to start point
-            graphVertex* actuelPredecessor; //the predecessor giving the for now shortest 
-                                            //path to start
-            graphVertex* currentNearestNonVisitedNeighboor; 
-            bool alreadyVisited;
-            graphVertex(){ //default constructor
-                position=0;
-                shortestDistanceToStart= std::numeric_limits<int>::max();
-                actuelPredecessor=nullptr;
-                alreadyVisited=false;
-                for(int kl =0; kl <4;kl++){
-                    adjacentVertices[kl]=nullptr;  //first put all position in array listing neighboors to 0
-                }
-            }
-            graphVertex(Vector3 wantedPosition){  //normal constructor
-                position=wantedPosition;
-                shortestDistanceToStart= std::numeric_limits<int>::max(); //default distance is infinity
-                actuelPredecessor=nullptr;
-                alreadyVisited=false;
-                for(int kl =0; kl <4;kl++){
-                    adjacentVertices[kl]=nullptr;  //first put all position in array listing neighboors to 0
-                }
-            }
-            graphVertex& operator = (const graphVertex &rightSide){
-            this->position=rightSide.position;
-    this->shortestDistanceToStart=rightSide.shortestDistanceToStart;
-            this->actuelPredecessor=rightSide.actuelPredecessor;
-    this->currentNearestNonVisitedNeighboor=rightSide.currentNearestNonVisitedNeighboor;
-    this->alreadyVisited=rightSide.alreadyVisited;
-    
-            return *this;
-        }
+			int shortestDistanceToStart; //actual shortest distance to start point
+			graphVertex* actuelPredecessor; //the predecessor giving the for now shortest 
+			//path to start
+			graphVertex* currentNearestNonVisitedNeighboor; 
+			bool alreadyVisited;
+			graphVertex(){ //default constructor
+				position=0;
+				shortestDistanceToStart= std::numeric_limits<int>::max();
+				actuelPredecessor=nullptr;
+				alreadyVisited=false;
+				for(int kl =0; kl <4;kl++){
+					adjacentVertices[kl]=nullptr;  //first put all position in array listing neighboors to 0
+				}
+			}
+			graphVertex(Vector3 wantedPosition){  //normal constructor
+				position=wantedPosition;
+				shortestDistanceToStart= std::numeric_limits<int>::max(); //default distance is infinity
+				actuelPredecessor=nullptr;
+				alreadyVisited=false;
+				for(int kl =0; kl <4;kl++){
+					adjacentVertices[kl]=nullptr;  //first put all position in array listing neighboors to 0
+				}
+			}
+			graphVertex& operator = (const graphVertex &rightSide){
+				this->position=rightSide.position;
+				this->shortestDistanceToStart=rightSide.shortestDistanceToStart;
+				this->actuelPredecessor=rightSide.actuelPredecessor;
+				this->currentNearestNonVisitedNeighboor=rightSide.currentNearestNonVisitedNeighboor;
+				this->alreadyVisited=rightSide.alreadyVisited;
 
-        };
+				return *this;
+			}
 
+	};
 
-    static PacmanGhost::graphVertex listOfVertices[67];
 
-    //Check if there is a collision
-        bool findpos(Vector3 one, Vector3 other){
-       if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true;
-        return false;
-        }
+	static PacmanGhost::graphVertex listOfVertices[67];
 
-    //All positions in the map, see documentation
-     Vector3 possibleposition[67] = {Vector3(20,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195), //0-4
-        Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9
-        Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-14
-        Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-19
-        Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-24
-        Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-29
-        Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-34
-        Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-39
-        Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-44
-        Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-49
-        Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-54
-        Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-59
-        Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-64
-        Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-66
+	//Check if there is a collision
+	bool findpos(Vector3 one, Vector3 other){
+		if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true;
+		return false;
+	}
 
-    RegisterClass(PacmanGhost);
+	//All positions in the map, see documentation
+	Vector3 possibleposition[67] = {Vector3(20,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195), //0-4
+		Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9
+		Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-14
+		Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-19
+		Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-24
+		Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-29
+		Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-34
+		Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-39
+		Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-44
+		Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-49
+		Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-54
+		Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-59
+		Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-64
+		Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-66
 
-    /**
-    @brief
-        Constructor. Registers the object and initializes some default values.
-    @param creator
-        The creator of this object.
-    */
-    PacmanGhost::PacmanGhost(Context* context) : ControllableEntity(context)
-    {
-        RegisterObject(PacmanGhost);
+	RegisterClass(PacmanGhost);
 
-        //this->pathAlgorithm = new GetShortestPathAlgorithm;
+	/**
+	  @brief
+	  Constructor. Registers the object and initializes some default values.
+	  @param creator
+	  The creator of this object.
+	  */
+	PacmanGhost::PacmanGhost(Context* context) : ControllableEntity(context)
+	{
+		RegisterObject(PacmanGhost);
 
+		this->velocity = Vector3(0, 0, 0);
 
-        this->velocity = Vector3(0, 0, 0);
+		this->setCollisionType(CollisionType::Dynamic);
 
-        this->setCollisionType(CollisionType::Dynamic);
-        
-        this->actuelposition = this->getPosition();
+		this->actuelposition = this->getPosition();
 
-        if(findpos(actuelposition, Vector3(0,-20,0)))
-            dontmove = true;
-        
-        this->target_x = actuelposition.x;
-        this->target_z = actuelposition.z; 
+		if(findpos(actuelposition, Vector3(0,-20,0)))
+			dontmove = true;
 
-        //this->lastPlayerPassedPoint=Vector3(185,10,150); //no idea what to put
+		this->target_x = actuelposition.x;
+		this->target_z = actuelposition.z; 
 
-    }
+	}
 
-    /**
-    @brief
-        Destructor. Destroys ghost, if present.
-    */
-    PacmanGhost::~PacmanGhost()
-    {
-        // Deletes the controller if the object was initialized and the pointer to the controller is not nullptr.
-    }
+	/**
+	  @brief
+	  Destructor. Destroys ghost, if present.
+	  */
+	PacmanGhost::~PacmanGhost()
+	{
+		// Deletes the controller if the object was initialized and the pointer to the controller is not nullptr.
+	}
 
-    /**
-    @brief
-        Method for creating a ghost through XML.
-    */
-     void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        SUPER(PacmanGhost, XMLPort, xmlelement, mode);
-    }
+	/**
+	  @brief
+	  Method for creating a ghost through XML.
+	  */
+	void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+	{
+		SUPER(PacmanGhost, XMLPort, xmlelement, mode);
+	}
 
-    //Change this with other ghost
-    void PacmanGhost::changewith(PacmanGhost* otherghost){
+	//Change this with other ghost
+	void PacmanGhost::changewith(PacmanGhost* otherghost){
 
-        while(lockmove){};
-        lockmove = true;    //Prevent change of target while ghost is changed
+		while(lockmove){};
+		lockmove = true;    //Prevent change of target while ghost is changed
 
-        otherghost->setPosition(this->getPosition());
-        this->setPosition(0,-20,0);
-        otherghost->target_x = this->target_x;   
-        otherghost->target_z = this->target_z;
-        otherghost->ismoving = this->ismoving;
+		otherghost->setPosition(this->getPosition());
+		this->setPosition(0,-20,0);
+		otherghost->target_x = this->target_x;   
+		otherghost->target_z = this->target_z;
+		otherghost->ismoving = this->ismoving;
 
-        this->dontmove = true;
-        otherghost->dontmove = false;
+		this->dontmove = true;
+		otherghost->dontmove = false;
 
-        lockmove = false;
-    }
+		lockmove = false;
+	}
 
-    //Move ghost with rotation
-    void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){
-        if(!dontmove){
-            this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt));
-        
-        //Rotate ghost in the direction of movement 
-        if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1)){
-            if(velocity.x<0){
-                 this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0)));  
-            }
-            else{
-                 this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0)));  
-            }
-        }
-        if((abs(abs(velocity.z)-1)<0.1) && (abs(velocity.x-0)<0.1)){
-            if(velocity.z<0){
-                 this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0)));  
-            }
-            else{
-                 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0)));  
-            }
-        }
-                     
-     }
-    }
+	//Move ghost with rotation
+	void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){
+		if(!dontmove){
+			this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt));
 
-    //Change ability to move
-    void PacmanGhost::changemovability(){
-        if(dontmove){
-         dontmove = false;}
-        else{
-         dontmove = true;   
-        }
-    }
+			//Rotate ghost in the direction of movement 
+			if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1)){
+				if(velocity.x<0){
+					this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0)));  
+				}
+				else{
+					this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0)));  
+				}
+			}
+			if((abs(abs(velocity.z)-1)<0.1) && (abs(velocity.x-0)<0.1)){
+				if(velocity.z<0){
+					this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0)));  
+				}
+				else{
+					this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0)));  
+				}
+			}
 
-    //ResetGhost
-    void PacmanGhost::resetGhost(){
-    
-        this->setPosition(this->resetposition);
-        this->ismoving = false;
-        this->actuelposition = this->getPosition();
-        
-        this->target_x = actuelposition.x;
-        this->target_z = actuelposition.z;
-    
-    }
+		}
+	}
 
-    //Increase speed of ghosts
-    void PacmanGhost::levelupvelo(){
-        speed ++;
-    }
+	//Change ability to move
+	void PacmanGhost::changemovability(){
+		if(dontmove){
+			dontmove = false;}
+		else{
+			dontmove = true;   
+		}
+	}
 
-    Vector3 PacmanGhost::getPlayerPos()
-    {
-        for (PacmanGelb* player : ObjectList<PacmanGelb>())
-        {
-            return player->getWorldPosition();
-        }
-        //std::cout<<"bug ??"<<endl;
-        return Vector3(0,0,0); //default, should not be used
-    
-    }
+	//ResetGhost
+	void PacmanGhost::resetGhost(){
 
+		this->setPosition(this->resetposition);
+		this->ismoving = false;
+		this->actuelposition = this->getPosition();
 
-    bool PacmanGhost::jeanfindpos(Vector3 one, Vector3 other){
-       if((abs(one.x - other.x)<15) && (abs(one.y - other.y)<15) && (abs(one.z - other.z)<15)) return true;
-        return false;
-        }
+		this->target_x = actuelposition.x;
+		this->target_z = actuelposition.z;
 
-    void PacmanGhost::setNewTargetGhost(Vector3 goalToGo){
+	}
 
-                    this->target_x = goalToGo.x;
-                    this->target_z = goalToGo.z; 
-                    this->ismoving = true;
-    }
+	//Increase speed of ghosts
+	void PacmanGhost::levelupvelo(){
+		speed ++;
+	}
 
+	Vector3 PacmanGhost::getPlayerPos()
+	{
+		for (PacmanGelb* player : ObjectList<PacmanGelb>())
+		{
+			return player->getWorldPosition();
+		}
+		//std::cout<<"bug ??"<<endl;
+		return Vector3(0,0,0); //default, should not be used
 
-    ///
-    //// getShortestPath   /////////
-    ///
+	}
 
-        
-        
-    Vector3 PacmanGhost::getShortestPath(Vector3 start, Vector3 goal, Vector3 pointToAvoidP1){
-        //this function should then somehow produce the algorithm and call all other functions
-        //and finally return the best neighboor of the actual position of the pacman
-        
-    //(optional parameter) pointToAvoidP1 is a point that cannot be considered
-        
 
-    graphVertex listOfVerticesM[67]; //our list of all possible graphs
-    graphVertex* actualVertex; //we will walk through the array with a pointer
-    
-        if(start==goal){ // basic case
-            return start; 
-        }
+	bool PacmanGhost::jeanfindpos(Vector3 one, Vector3 other){
+		if((abs(one.x - other.x)<15) && (abs(one.y - other.y)<15) && (abs(one.z - other.z)<15)) return true;
+		return false;
+	}
 
-        for(int an=0; an < 67; an++){
-      listOfVerticesM[an]= graphVertex(possibleposition[an]); //same position order as in other file
-    if(start==possibleposition[an]){
-     actualVertex= &listOfVerticesM[an]; //our pointer points to the graph with position start in array
-    //cout<<an<<endl;
-        }
-        }
+	void PacmanGhost::setNewTargetGhost(Vector3 goalToGo){
 
-        //graphVertex actualVertex= listOfVerticesM[an];
+		this->target_x = goalToGo.x;
+		this->target_z = goalToGo.z; 
+		this->ismoving = true;
+	}
 
-        actualVertex->alreadyVisited=true; //our start point is now visited
-        actualVertex->shortestDistanceToStart=0; //At our start point, distance from start is 0
-        findNeighboorVertices(actualVertex->position, actualVertex->adjacentVertices, listOfVerticesM); 
-        // second parameter is an array ! //third is our global array
 
-        while(actualVertex->position!=goal){
-            for(int h=0;h < 4; h++){
-                if(actualVertex->adjacentVertices[h]!=nullptr){ //check all neighboors of our current graphVertex
- 
-         //h=2 and 3 never reached
-                    updateShortestDistanceToStart(*actualVertex, *actualVertex->adjacentVertices[h]);
-                } //we "update" the neighboors of our new visited vertex
-        
-            }
-            
-            actualVertex=findNextVertexToConsider(listOfVerticesM, pointToAvoidP1);
-            actualVertex->alreadyVisited=true;
-    //cout<<actualVertex->position<<endl;
-            if(actualVertex->position!=goal){
-                findNeighboorVertices(actualVertex->position, actualVertex->adjacentVertices, listOfVerticesM); 
-                //we find the neighboors of our new visited vertex
-                }
-        }
+	///
+	//// getShortestPath   /////////
+	///
 
-    //cout<<"meuejeeke"<<endl; never reached
 
-        //we should have reached our goal at this point
 
-        while(actualVertex->actuelPredecessor->actuelPredecessor!=nullptr){ //the predecessor of our predecessor
-            actualVertex=actualVertex->actuelPredecessor;
-        }
-        // the predecessor is our starting point, in other words we are now on an
-        //adjacent vertex of the start
+	Vector3 PacmanGhost::getShortestPath(Vector3 start, Vector3 goal, Vector3 pointToAvoidP1){
+		//this function should then somehow produce the algorithm and call all other functions
+		//and finally return the best neighboor of the actual position of the pacman
 
-        return actualVertex->position; //we return the position of this - adjacent to start - vertex
-    }
+		//(optional parameter) pointToAvoidP1 is a point that cannot be considered
 
-//end of getShortestPath
 
+		graphVertex listOfVerticesM[67]; //our list of all possible graphs
+		graphVertex* actualVertex; //we will walk through the array with a pointer
 
-    int PacmanGhost::graphDistance(Vector3 start, Vector3 goal){
-    //cout<<hgj++<<endl;
-        Vector3 differenceVector= Vector3(abs(goal.x-start.x), 0,abs(goal.z-start.z));
+        //vector<graphVertex> listOfVertices;
 
-        return differenceVector.x+differenceVector.z;
-    }
 
-    void PacmanGhost::updateShortestDistanceToStart(graphVertex &vertex, graphVertex &neighboor){
-        //apply this method to all non visited neighboors of a vertex.
-        // This method should always be run on a vertex after we marked it as visited.
-        if(neighboor.alreadyVisited==false){ //we only consider non visited neighboors.
-            if((vertex.shortestDistanceToStart!=std::numeric_limits<int>::max())&&
-        (neighboor.shortestDistanceToStart > vertex.shortestDistanceToStart + 
-                graphDistance(vertex.position, neighboor.position))){ //need to consider overflow case !
-        
-                neighboor.shortestDistanceToStart= vertex.shortestDistanceToStart + 
-                graphDistance(vertex.position, neighboor.position);
-                neighboor.actuelPredecessor = &vertex;
-            }
-        }
-    }
+		if(start==goal){ // basic case
+			return start; 
+		}
 
-    void PacmanGhost::findNearestNonVisitedNeighboor (graphVertex &vertex, Vector3 pointToAvoidP3){ 
-            //find nearest non visited neighboor of a given already visited vertex
-    //(optional parameter) pointToAvoidP3 is a point that cannot be considered
-        int shortestDistance = -1;
-        graphVertex* nearestNonVisitedNeighboor=nullptr;//=graphVertex(); //by default there is not any.
-        //Also, if all neighboors are already visited, we return NULL, i.e. there is no
-        //nearest non visited neighboor.
-        for(int i=0; i < 4; i++){
-            if((vertex.adjacentVertices[i]!=nullptr)&&(vertex.adjacentVertices[i]->alreadyVisited==false)&&(vertex.adjacentVertices[i]->position!=pointToAvoidP3)){
-                if(shortestDistance==-1){   //(concerns line above) we want a non visited neighboor //(optional) if the position of the neighboor is the one we want
-    //to avoid, then we ignore it
+		for(int an=0; an < 67; an++){
+			listOfVerticesM[an]= graphVertex(possibleposition[an]); //same position order as in other file
+            //listOfVertices.at(an) = graphVertex(possibleposition[an]);
 
-                    shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position);
-                    nearestNonVisitedNeighboor=vertex.adjacentVertices[i]; //warning, both sides are pointer adresses !
-    //cout<<shortestDistance<<endl;
-                }
-                else if(graphDistance(vertex.position, vertex.adjacentVertices[i]->position)<shortestDistance){
-                    shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position);
-                    nearestNonVisitedNeighboor=vertex.adjacentVertices[i]; //warning, both sides are pointer adresses !
-        //cout<<(hgj++)%4<<endl;
-                }
-            }
-        }
-        vertex.currentNearestNonVisitedNeighboor = nearestNonVisitedNeighboor; //warning, both sides are pointer adresses !
-    //cout<<hgj++<<endl;
-    }
+			if(start==possibleposition[an]){
+				actualVertex= &listOfVerticesM[an]; //our pointer points to the graph with position start in array
+				//cout<<an<<endl;
+			}
+		}
 
+		//graphVertex actualVertex= listOfVerticesM[an];
 
-    PacmanGhost::graphVertex* PacmanGhost::findNextVertexToConsider(graphVertex listOfVerticesP[], Vector3 pointToAvoidP2){ //find next, nearest from start, non visited vertex in our listOfVertices array
-    //(optional parameter) pointToAvoidP2 is a point that cannot be considered
+		actualVertex->alreadyVisited=true; //our start point is now visited
+		actualVertex->shortestDistanceToStart=0; //At our start point, distance from start is 0
+		findNeighboorVertices(actualVertex->position, actualVertex->adjacentVertices, listOfVerticesM); 
+		// second parameter is an array ! //third is our global array
 
-        int shortestDistance = -1;
-        graphVertex* nextVertexToConsider;
+		while(actualVertex->position!=goal){
+			for(int h=0;h < 4; h++){
+				if(actualVertex->adjacentVertices[h]!=nullptr){ //check all neighboors of our current graphVertex
 
-        for(int i=0; i < 67; i++){ //we loop over all possible positions 
+					//h=2 and 3 never reached
+					updateShortestDistanceToStart(*actualVertex, *actualVertex->adjacentVertices[h]);
+				} //we "update" the neighboors of our new visited vertex
 
-            if(listOfVerticesP[i].alreadyVisited==true){ //vertex should already be visited 
+			}
 
-                findNearestNonVisitedNeighboor(listOfVerticesP[i], pointToAvoidP2); //we update nearest neighboor
-                //of all visited vertices given that one of the nearest neighboor of a visited
-                // vertex is now also visited because it was chosen as next optimal vertex
+            if(actualVertex==nullptr){
+                std::cout<<"Ornopdpde"<<endl;
+            }
 
-                if(listOfVerticesP[i].currentNearestNonVisitedNeighboor!=nullptr){ //we want a candidate!
-                if(shortestDistance==-1){ //our first possible candidate
+			actualVertex=findNextVertexToConsider(listOfVerticesM, pointToAvoidP1);
+			actualVertex->alreadyVisited=true;
+			//cout<<actualVertex->position<<endl;
+			if(actualVertex->position!=goal){
+				findNeighboorVertices(actualVertex->position, actualVertex->adjacentVertices, listOfVerticesM); 
+				//we find the neighboors of our new visited vertex
+			}
+		}
 
-            shortestDistance=graphDistance(listOfVerticesP[i].position, 
-            listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 
-            listOfVerticesP[i].shortestDistanceToStart;
+		//cout<<"meuejeeke"<<endl; never reached
 
-            nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor;
-    //adress of nextVertexToConsider is that of pointer currentNearestNonVisitedNeighboor
+		//we should have reached our goal at this point
 
-                }
-                else if(shortestDistance > graphDistance(listOfVerticesP[i].position, 
-                listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 
-                    listOfVerticesP[i].shortestDistanceToStart){//if better candidate than our first candidate available
+		while(actualVertex->actuelPredecessor->actuelPredecessor!=nullptr){ //the predecessor of our predecessor
+			actualVertex=actualVertex->actuelPredecessor;
+		}
+		// the predecessor is our starting point, in other words we are now on an
+		//adjacent vertex of the start
 
-            shortestDistance=graphDistance(listOfVerticesP[i].position, 
-            listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 
-            listOfVerticesP[i].shortestDistanceToStart;
+		return actualVertex->position; //we return the position of this - adjacent to start - vertex
+	}
 
-            nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor;
-    //we dont need the & because we are not giving the adress of the array element 
-    //listOfVerticesP[i] but that of the pointer currentNearestNonVisitedNeighboor
-                    }
-                }
-            }
-            //we want after all to return the nearest non visited neighboor
-        }
+	//end of getShortestPath
 
-        return nextVertexToConsider; //returns adress nextVertexToConsider is pointing to in array
-    }
 
-    //////////////////////////////////////////////////////////////////////////////////////////////
+	int PacmanGhost::graphDistance(Vector3 start, Vector3 goal){
+		//cout<<hgj++<<endl;
+		Vector3 differenceVector= Vector3(abs(goal.x-start.x), 0,abs(goal.z-start.z));
 
-    //if vertex already visited, call function on it and reapeat until you reach non visited vertex
-    // ---> not sure if a good idea because we risk infinite loop
+		return differenceVector.x+differenceVector.z;
+	}
 
-    //-215 -185 -135 -70 -20 0 20 70 135 185 215 
+	void PacmanGhost::updateShortestDistanceToStart(graphVertex &vertex, graphVertex &neighboor){
+		//apply this method to all non visited neighboors of a vertex.
+		// This method should always be run on a vertex after we marked it as visited.
+		if(neighboor.alreadyVisited==false){ //we only consider non visited neighboors.
+			if((vertex.shortestDistanceToStart!=std::numeric_limits<int>::max())&&
+					(neighboor.shortestDistanceToStart > vertex.shortestDistanceToStart + 
+					 graphDistance(vertex.position, neighboor.position))){ //need to consider overflow case !
 
-    //-195 -135 -85 -35 15 60 105 150 195 245
+				neighboor.shortestDistanceToStart= vertex.shortestDistanceToStart + 
+					graphDistance(vertex.position, neighboor.position);
+				neighboor.actuelPredecessor = &vertex;
+			}
+		}
+	}
 
-    void PacmanGhost::findNeighboorVertices(Vector3 actuelposition, graphVertex* adjacentVertices[], graphVertex listOfVerticesP2[]){      
+	void PacmanGhost::findNearestNonVisitedNeighboor (graphVertex &vertex, Vector3 pointToAvoidP3){ 
+		//find nearest non visited neighboor of a given already visited vertex
+		//(optional parameter) pointToAvoidP3 is a point that cannot be considered
+		int shortestDistance = -1;
+		graphVertex* nearestNonVisitedNeighboor=nullptr;//=graphVertex(); //by default there is not any.
+		//Also, if all neighboors are already visited, we return NULL, i.e. there is no
+		//nearest non visited neighboor.
+		for(int i=0; i < 4; i++){
+			if((vertex.adjacentVertices[i]!=nullptr)&&(vertex.adjacentVertices[i]->alreadyVisited==false)&&(vertex.adjacentVertices[i]->position!=pointToAvoidP3)){
+				if(shortestDistance==-1){   //(concerns line above) we want a non visited neighboor //(optional) if the position of the neighboor is the one we want
+					//to avoid, then we ignore it
 
+					shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position);
+					nearestNonVisitedNeighboor=vertex.adjacentVertices[i]; //warning, both sides are pointer adresses !
+					//cout<<shortestDistance<<endl;
+				}
+				else if(graphDistance(vertex.position, vertex.adjacentVertices[i]->position)<shortestDistance){
+					shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position);
+					nearestNonVisitedNeighboor=vertex.adjacentVertices[i]; //warning, both sides are pointer adresses !
+					//cout<<(hgj++)%4<<endl;
+				}
+			}
+		}
+		vertex.currentNearestNonVisitedNeighboor = nearestNonVisitedNeighboor; //warning, both sides are pointer adresses !
+		//cout<<hgj++<<endl;
+	}
 
-            if(findpos(actuelposition,possibleposition[0])){
-                // we should use listOfVerticesP2[i] instead of possibleposition[i] I think
-                // so that all neighboors are "the same"
-                adjacentVertices[0]=&listOfVerticesP2[1]; //graphVertex(possibleposition[1]);  //need to do it everywhere !!!
-                adjacentVertices[1]=&listOfVerticesP2[17]; //graphVertex(possibleposition[17]);
-                adjacentVertices[2]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ?
-            }
-            else if(findpos(actuelposition,possibleposition[1])){
-                adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]);
-                adjacentVertices[1]=&listOfVerticesP2[2]; //graphVertex(possibleposition[2]);
-            }
-            else if(findpos(actuelposition,possibleposition[2])){
-                adjacentVertices[0]=&listOfVerticesP2[1]; //graphVertex(possibleposition[1]);
-                adjacentVertices[1]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]);
-            }
-            else if(findpos(actuelposition,possibleposition[3])){
-                adjacentVertices[0]=&listOfVerticesP2[2]; //graphVertex(possibleposition[2]);
-                adjacentVertices[1]=&listOfVerticesP2[4]; //graphVertex(possibleposition[4]);
-                adjacentVertices[2]=&listOfVerticesP2[5]; //graphVertex(possibleposition[5]);
-            }
-            else if(findpos(actuelposition,possibleposition[4])){
-                adjacentVertices[0]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]);
-                adjacentVertices[1]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]);
-            }
-            else if(findpos(actuelposition,possibleposition[5])){
-                adjacentVertices[0]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]);
-                adjacentVertices[1]=&listOfVerticesP2[7]; //graphVertex(possibleposition[7]);
-            }
-            else if(findpos(actuelposition,possibleposition[6])){
-                adjacentVertices[0]=&listOfVerticesP2[4]; //graphVertex(possibleposition[4]);
-                adjacentVertices[1]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);
-                adjacentVertices[2]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]);
-            }
-            else if(findpos(actuelposition,possibleposition[7])){
-                adjacentVertices[0]=&listOfVerticesP2[5]; //graphVertex(possibleposition[5]);
-                adjacentVertices[1]=&listOfVerticesP2[8]; //graphVertex(possibleposition[8]);
-            }
-            else if(findpos(actuelposition,possibleposition[8])){
-                adjacentVertices[0]=&listOfVerticesP2[7]; //graphVertex(possibleposition[7]);
-                adjacentVertices[1]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);
-            }
-            else if(findpos(actuelposition,possibleposition[9])){
-                adjacentVertices[0]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]);
-                adjacentVertices[1]=&listOfVerticesP2[8]; //graphVertex(possibleposition[8]);
-                adjacentVertices[2]=&listOfVerticesP2[10]; //graphVertex(possibleposition[10]);
-                adjacentVertices[3]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]);
-            }
-            else if(findpos(actuelposition,possibleposition[10])){
-                adjacentVertices[0]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);
-                adjacentVertices[1]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]);
-                adjacentVertices[2]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]);
-            }
-            else if(findpos(actuelposition,possibleposition[11])){
-                adjacentVertices[0]=&listOfVerticesP2[10]; //graphVertex(possibleposition[10]);
-                adjacentVertices[1]=&listOfVerticesP2[12]; //graphVertex(possibleposition[12]);
-                adjacentVertices[2]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);
-            }
-            else if(findpos(actuelposition,possibleposition[12])){
-                adjacentVertices[0]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]);
-                adjacentVertices[1]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]);
-            }
-            else if(findpos(actuelposition,possibleposition[13])){
-                adjacentVertices[0]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]);
-                adjacentVertices[1]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]);
-                adjacentVertices[2]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]);
-                adjacentVertices[3]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]);
-            }
-            else if(findpos(actuelposition,possibleposition[14])){
-                adjacentVertices[0]=&listOfVerticesP2[12]; //graphVertex(possibleposition[12]);
-                adjacentVertices[1]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);
-                adjacentVertices[2]=&listOfVerticesP2[15]; //graphVertex(possibleposition[15]);
-            }
-            else if(findpos(actuelposition,possibleposition[15])){
-                adjacentVertices[0]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]);
-                adjacentVertices[1]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]);
-            }
-            else if(findpos(actuelposition,possibleposition[16])){
-                adjacentVertices[0]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);
-                adjacentVertices[1]=&listOfVerticesP2[15]; //graphVertex(possibleposition[15]);
-                adjacentVertices[2]=&listOfVerticesP2[62]; //graphVertex(possibleposition[62]);
-            }
-            else if(findpos(actuelposition,possibleposition[17])){
-                adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]);
-                adjacentVertices[1]=&listOfVerticesP2[25]; //graphVertex(possibleposition[25]);
-            }
-            else if(findpos(actuelposition,possibleposition[18])){
-                adjacentVertices[0]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]);
-                adjacentVertices[1]=&listOfVerticesP2[24]; //graphVertex(possibleposition[24]);                
-            }
-            else if(findpos(actuelposition,possibleposition[19])){
-                adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]);
-                adjacentVertices[1]=&listOfVerticesP2[18]; //graphVertex(possibleposition[18]);
-                adjacentVertices[2]=&listOfVerticesP2[20]; //graphVertex(possibleposition[20]);
-                         }
-            else if(findpos(actuelposition,possibleposition[20])){
-                adjacentVertices[0]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]);
-                adjacentVertices[1]=&listOfVerticesP2[21]; //graphVertex(possibleposition[21]);
-                       }
-            else if(findpos(actuelposition,possibleposition[21])){
-                adjacentVertices[0]=&listOfVerticesP2[20]; //graphVertex(possibleposition[20]);
-                adjacentVertices[1]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]);
-                       }
-            else if(findpos(actuelposition,possibleposition[22])){
-                adjacentVertices[0]=&listOfVerticesP2[21]; //graphVertex(possibleposition[21]);
-                adjacentVertices[1]=&listOfVerticesP2[23]; //graphVertex(possibleposition[23]);
-                adjacentVertices[2]=&listOfVerticesP2[31]; //graphVertex(possibleposition[31]);
-                          }
-            else if(findpos(actuelposition,possibleposition[23])){
-                adjacentVertices[0]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]);
-                adjacentVertices[1]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]);
-                       }
-            else if(findpos(actuelposition,possibleposition[24])){
-                adjacentVertices[0]=&listOfVerticesP2[18]; //graphVertex(possibleposition[18]);
-                adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]);
-                       }
-            else if(findpos(actuelposition,possibleposition[25])){
-                adjacentVertices[0]=&listOfVerticesP2[17]; //graphVertex(possibleposition[17]);
-                adjacentVertices[1]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]);
-                       }
-            else if(findpos(actuelposition,possibleposition[26])){
-                adjacentVertices[0]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]);
-                adjacentVertices[1]=&listOfVerticesP2[25]; //graphVertex(possibleposition[25]);
-                adjacentVertices[2]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]);
-                         }
-            else if(findpos(actuelposition,possibleposition[27])){
-                adjacentVertices[0]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]);
-                adjacentVertices[1]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]);
-                adjacentVertices[2]=&listOfVerticesP2[37]; //graphVertex(possibleposition[37]);
-                          }
-            else if(findpos(actuelposition,possibleposition[28])){
-                adjacentVertices[0]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]);
-                adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]);
-                adjacentVertices[2]=&listOfVerticesP2[36]; //graphVertex(possibleposition[36]);
-                          }
-            else if(findpos(actuelposition,possibleposition[29])){
-                adjacentVertices[0]=&listOfVerticesP2[24]; //graphVertex(possibleposition[24]);
-                adjacentVertices[1]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]);
-                adjacentVertices[2]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]);
-                          }
-            else if(findpos(actuelposition,possibleposition[30])){
-                adjacentVertices[0]=&listOfVerticesP2[23]; //graphVertex(possibleposition[23]);
-                adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]);
-                adjacentVertices[2]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);
-                          }
-            else if(findpos(actuelposition,possibleposition[31])){
-                adjacentVertices[0]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]);
-                adjacentVertices[1]=&listOfVerticesP2[32]; //graphVertex(possibleposition[32]);
-                       }
-            else if(findpos(actuelposition,possibleposition[32])){
-                adjacentVertices[0]=&listOfVerticesP2[31]; //graphVertex(possibleposition[31]);
-                adjacentVertices[1]=&listOfVerticesP2[33]; //graphVertex(possibleposition[33]);
-                       }
-            else if(findpos(actuelposition,possibleposition[33])){
-                adjacentVertices[0]=&listOfVerticesP2[32]; //graphVertex(possibleposition[32]);
-                adjacentVertices[1]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);
-                       }
-            else if(findpos(actuelposition,possibleposition[34])){
-                adjacentVertices[0]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]);
-                adjacentVertices[1]=&listOfVerticesP2[33]; //graphVertex(possibleposition[33]);
-                adjacentVertices[2]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);
-                adjacentVertices[3]=&listOfVerticesP2[42]; //graphVertex(possibleposition[42]);
-                
-            }
-            else if(findpos(actuelposition,possibleposition[35])){
-                adjacentVertices[0]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);
-                adjacentVertices[1]=&listOfVerticesP2[36]; //graphVertex(possibleposition[36]);
-                adjacentVertices[2]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);
-                          }
-            else if(findpos(actuelposition,possibleposition[36])){
-                adjacentVertices[0]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]);
-                adjacentVertices[1]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);
-                       }
-            else if(findpos(actuelposition,possibleposition[37])){
-                adjacentVertices[0]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]);
-                adjacentVertices[1]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]);
-                       }
-            else if(findpos(actuelposition,possibleposition[38])){
-                adjacentVertices[0]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);
-                adjacentVertices[1]=&listOfVerticesP2[37]; //graphVertex(possibleposition[37]);
-                adjacentVertices[2]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]);
-                         }
-            else if(findpos(actuelposition,possibleposition[39])){
-                adjacentVertices[0]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]);
-                adjacentVertices[1]=&listOfVerticesP2[40]; //graphVertex(possibleposition[40]);
-                adjacentVertices[2]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]);
-                          }
-            else if(findpos(actuelposition,possibleposition[40])){
-                adjacentVertices[0]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]);
-                adjacentVertices[1]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);
-            }
-            else if(findpos(actuelposition,possibleposition[41])){
-                adjacentVertices[0]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);
-                adjacentVertices[1]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);
-                adjacentVertices[2]=&listOfVerticesP2[40]; //error meuh
-                       }
-            else if(findpos(actuelposition,possibleposition[42])){
-                adjacentVertices[0]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);
-                adjacentVertices[1]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);
-                adjacentVertices[2]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]);
-                          }
-            else if(findpos(actuelposition,possibleposition[43])){
-                adjacentVertices[0]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);
-                adjacentVertices[1]=&listOfVerticesP2[46]; //graphVertex(possibleposition[46]);
-                adjacentVertices[2]=&listOfVerticesP2[42]; //error meuh
-                       }
-            else if(findpos(actuelposition,possibleposition[44])){
-                adjacentVertices[0]=&listOfVerticesP2[40]; //graphVertex(possibleposition[40]);
-                adjacentVertices[1]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]);
-                       }
-            else if(findpos(actuelposition,possibleposition[45])){
-                adjacentVertices[0]=&listOfVerticesP2[10]; //graphVertex(possibleposition[10]);
-                adjacentVertices[1]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]);
-                adjacentVertices[2]=&listOfVerticesP2[49]; //graphVertex(possibleposition[49]);
-                          }
-            else if(findpos(actuelposition,possibleposition[46])){
-                adjacentVertices[0]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);
-                adjacentVertices[1]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]);
-                       }
-            else if(findpos(actuelposition,possibleposition[47])){
-                adjacentVertices[0]=&listOfVerticesP2[46]; //graphVertex(possibleposition[46]);
-                adjacentVertices[1]=&listOfVerticesP2[52]; //graphVertex(possibleposition[52]);
-                adjacentVertices[2]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]);
-                          }
-            else if(findpos(actuelposition,possibleposition[48])){
-                adjacentVertices[0]=&listOfVerticesP2[49]; //graphVertex(possibleposition[49]);
-                adjacentVertices[1]=&listOfVerticesP2[51]; //graphVertex(possibleposition[51]);
-                adjacentVertices[2]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]);
-                          }
-            else if(findpos(actuelposition,possibleposition[49])){
-                adjacentVertices[0]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]);
-                adjacentVertices[1]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]);
-                       }
-            else if(findpos(actuelposition,possibleposition[50])){
-                adjacentVertices[0]=&listOfVerticesP2[51]; //graphVertex(possibleposition[51]);
-                adjacentVertices[1]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]);
-                       }
-            else if(findpos(actuelposition,possibleposition[51])){
-                adjacentVertices[0]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]);
-                adjacentVertices[1]=&listOfVerticesP2[50]; //graphVertex(possibleposition[50]);
-                       }
-            else if(findpos(actuelposition,possibleposition[52])){
-                adjacentVertices[0]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]);
-                adjacentVertices[1]=&listOfVerticesP2[53]; //graphVertex(possibleposition[53]);
-                       }
-            else if(findpos(actuelposition,possibleposition[53])){
-                adjacentVertices[0]=&listOfVerticesP2[52]; //graphVertex(possibleposition[52]);
-                adjacentVertices[1]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);
-                       }
-            else if(findpos(actuelposition,possibleposition[54])){
-                adjacentVertices[0]=&listOfVerticesP2[42]; //graphVertex(possibleposition[42]);
-                adjacentVertices[1]=&listOfVerticesP2[55]; //graphVertex(possibleposition[55]);
-                adjacentVertices[2]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);
-                          }
-            else if(findpos(actuelposition,possibleposition[55])){
-                adjacentVertices[0]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]);
-                adjacentVertices[1]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]);
-                       }
-            else if(findpos(actuelposition,possibleposition[56])){
-                adjacentVertices[0]=&listOfVerticesP2[55]; //graphVertex(possibleposition[55]);
-                adjacentVertices[1]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);
-                adjacentVertices[2]=&listOfVerticesP2[65]; //graphVertex(possibleposition[65]);
-                          }
-            else if(findpos(actuelposition,possibleposition[57])){
-                adjacentVertices[0]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]);
-                adjacentVertices[1]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]);
-                adjacentVertices[2]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);
-                adjacentVertices[3]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]);
-                
-            }
-            else if(findpos(actuelposition,possibleposition[58])){
-                adjacentVertices[0]=&listOfVerticesP2[53]; //graphVertex(possibleposition[53]);
-                adjacentVertices[1]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);
-                adjacentVertices[2]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);
-                          }
-            else if(findpos(actuelposition,possibleposition[59])){
-                adjacentVertices[0]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);
-                adjacentVertices[1]=&listOfVerticesP2[60]; //graphVertex(possibleposition[59]);
-                adjacentVertices[2]=&listOfVerticesP2[63]; //graphVertex(possibleposition[63]);
-                          }
-            else if(findpos(actuelposition,possibleposition[60])){
-                adjacentVertices[0]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);
-                adjacentVertices[1]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]);
-                adjacentVertices[2]=&listOfVerticesP2[62]; //graphVertex(possibleposition[62]);
-                          }
-            else if(findpos(actuelposition,possibleposition[61])){
-                adjacentVertices[0]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);
-                adjacentVertices[1]=&listOfVerticesP2[50]; //graphVertex(possibleposition[50]);
-                adjacentVertices[2]=&listOfVerticesP2[60]; //graphVertex(possibleposition[60]);
-                          }
-            else if(findpos(actuelposition,possibleposition[62])){
-                adjacentVertices[0]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]);
-                adjacentVertices[1]=&listOfVerticesP2[60]; //graphVertex(possibleposition[60]);
-                       }
-            else if(findpos(actuelposition,possibleposition[63])){
-                adjacentVertices[0]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);
-                adjacentVertices[1]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]);
-                       }
-            else if(findpos(actuelposition,possibleposition[64])){
-                adjacentVertices[0]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);
-                adjacentVertices[1]=&listOfVerticesP2[63]; //graphVertex(possibleposition[63]);
-                adjacentVertices[2]=&listOfVerticesP2[65]; //graphVertex(possibleposition[65]);
-                          }
-            else if(findpos(actuelposition,possibleposition[65])){
-                adjacentVertices[0]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]);
-                adjacentVertices[1]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]);
-                       }
-            else if(findpos(actuelposition,possibleposition[66])){
-                adjacentVertices[0]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]);
-                adjacentVertices[1]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]);
-                       }
-    }
 
-    //functions taken from PacmanPink
+	PacmanGhost::graphVertex* PacmanGhost::findNextVertexToConsider(graphVertex listOfVerticesP[], Vector3 pointToAvoidP2){ //find next, nearest from start, non visited vertex in our listOfVertices array
+		//(optional parameter) pointToAvoidP2 is a point that cannot be considered
 
+		int shortestDistance = -1;
+		graphVertex* nextVertexToConsider;
 
-    Vector3 PacmanGhost::diffVector (Vector3 start, Vector3 goal){
+		for(int i=0; i < 67; i++){ //we loop over all possible positions 
 
-        Vector3 result;
-        result.x=goal.x-start.x;
-        result.z=goal.z-start.z;
-        return result;
-    }
+			if(listOfVerticesP[i].alreadyVisited==true){ //vertex should already be visited 
 
+				findNearestNonVisitedNeighboor(listOfVerticesP[i], pointToAvoidP2); //we update nearest neighboor
+				//of all visited vertices given that one of the nearest neighboor of a visited
+				// vertex is now also visited because it was chosen as next optimal vertex
 
-    bool PacmanGhost::playerFindPos(Vector3 one, Vector3 other){
-       if((abs(one.x - other.x)<15) && (abs(one.z - other.z)<15)) return true;
-        return false;
-        }
+				if(listOfVerticesP[i].currentNearestNonVisitedNeighboor!=nullptr){ //we want a candidate!
+					if(shortestDistance==-1){ //our first possible candidate
 
+						shortestDistance=graphDistance(listOfVerticesP[i].position, 
+								listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 
+							listOfVerticesP[i].shortestDistanceToStart;
 
+						nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor;
+						//adress of nextVertexToConsider is that of pointer currentNearestNonVisitedNeighboor
 
+					}
+					else if(shortestDistance > graphDistance(listOfVerticesP[i].position, 
+								listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 
+							listOfVerticesP[i].shortestDistanceToStart){//if better candidate than our first candidate available
 
-    int PacmanGhost::findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos){
-        //return 0 for south, 1 for west, 2 for north, 3 for east
+						shortestDistance=graphDistance(listOfVerticesP[i].position, 
+								listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 
+							listOfVerticesP[i].shortestDistanceToStart;
 
+						nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor;
+						//we dont need the & because we are not giving the adress of the array element 
+						//listOfVerticesP[i] but that of the pointer currentNearestNonVisitedNeighboor
+					}
+				}
+			}
+			//we want after all to return the nearest non visited neighboor
+		}
 
-        if(playerFindPos(playerPosBefore, playerPos)){
-            //if player is still near last crossed point
+		return nextVertexToConsider; //returns adress nextVertexToConsider is pointing to in array
+	}
 
-            return 4; //return the last crossed point for simplicity
-        }
+	//////////////////////////////////////////////////////////////////////////////////////////////
 
+	//-215 -185 -135 -70 -20 0 20 70 135 185 215 
 
-        if(abs(playerPos.x-playerPosBefore.x)<14){ //player is moving vertically
-            if((playerPos.z-playerPosBefore.z)<0){//move west
-                return 0;
-            }
-            if((playerPos.z-playerPosBefore.z)>0){//move east
-                return 2;
-            }
-        }
+	//-195 -135 -85 -35 15 60 105 150 195 245
 
-        if(abs(playerPos.z-playerPosBefore.z)<14){ //player is moving horizontally
-            if((playerPos.x-playerPosBefore.x)<0){//move south
-                return 1;
-            }
-            if((playerPos.x-playerPosBefore.x)>0){//move north
-                return 3;
-            }
-        }
-        
-        }
+	void PacmanGhost::findNeighboorVertices(Vector3 actuelposition, graphVertex* adjacentVertices[], graphVertex listOfVerticesP2[]){      
 
-    Vector3 PacmanGhost::getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE){
-        //return the Vector3 point that Pinky should target to
-        //be in front of pacman
 
-        if(indexForSWNE==4){
-            //std::cout<<"Ryukyu"<<endl;
-            return pacLasVisPos;
-        }
+		if(findpos(actuelposition,possibleposition[0])){
+			// we should use listOfVerticesP2[i] instead of possibleposition[i] I think
+			// so that all neighboors are "the same"
+			adjacentVertices[0]=&listOfVerticesP2[1]; //graphVertex(possibleposition[1]);  //need to do it everywhere !!!
+			adjacentVertices[1]=&listOfVerticesP2[17]; //graphVertex(possibleposition[17]);
+			adjacentVertices[2]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ?
+		}
+		else if(findpos(actuelposition,possibleposition[1])){
+			adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]);
+			adjacentVertices[1]=&listOfVerticesP2[2]; //graphVertex(possibleposition[2]);
+		}
+		else if(findpos(actuelposition,possibleposition[2])){
+			adjacentVertices[0]=&listOfVerticesP2[1]; //graphVertex(possibleposition[1]);
+			adjacentVertices[1]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]);
+		}
+		else if(findpos(actuelposition,possibleposition[3])){
+			adjacentVertices[0]=&listOfVerticesP2[2]; //graphVertex(possibleposition[2]);
+			adjacentVertices[1]=&listOfVerticesP2[4]; //graphVertex(possibleposition[4]);
+			adjacentVertices[2]=&listOfVerticesP2[5]; //graphVertex(possibleposition[5]);
+		}
+		else if(findpos(actuelposition,possibleposition[4])){
+			adjacentVertices[0]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]);
+			adjacentVertices[1]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]);
+		}
+		else if(findpos(actuelposition,possibleposition[5])){
+			adjacentVertices[0]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]);
+			adjacentVertices[1]=&listOfVerticesP2[7]; //graphVertex(possibleposition[7]);
+		}
+		else if(findpos(actuelposition,possibleposition[6])){
+			adjacentVertices[0]=&listOfVerticesP2[4]; //graphVertex(possibleposition[4]);
+			adjacentVertices[1]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);
+			adjacentVertices[2]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]);
+		}
+		else if(findpos(actuelposition,possibleposition[7])){
+			adjacentVertices[0]=&listOfVerticesP2[5]; //graphVertex(possibleposition[5]);
+			adjacentVertices[1]=&listOfVerticesP2[8]; //graphVertex(possibleposition[8]);
+		}
+		else if(findpos(actuelposition,possibleposition[8])){
+			adjacentVertices[0]=&listOfVerticesP2[7]; //graphVertex(possibleposition[7]);
+			adjacentVertices[1]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);
+		}
+		else if(findpos(actuelposition,possibleposition[9])){
+			adjacentVertices[0]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]);
+			adjacentVertices[1]=&listOfVerticesP2[8]; //graphVertex(possibleposition[8]);
+			adjacentVertices[2]=&listOfVerticesP2[10]; //graphVertex(possibleposition[10]);
+			adjacentVertices[3]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]);
+		}
+		else if(findpos(actuelposition,possibleposition[10])){
+			adjacentVertices[0]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);
+			adjacentVertices[1]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]);
+			adjacentVertices[2]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]);
+		}
+		else if(findpos(actuelposition,possibleposition[11])){
+			adjacentVertices[0]=&listOfVerticesP2[10]; //graphVertex(possibleposition[10]);
+			adjacentVertices[1]=&listOfVerticesP2[12]; //graphVertex(possibleposition[12]);
+			adjacentVertices[2]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);
+		}
+		else if(findpos(actuelposition,possibleposition[12])){
+			adjacentVertices[0]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]);
+			adjacentVertices[1]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]);
+		}
+		else if(findpos(actuelposition,possibleposition[13])){
+			adjacentVertices[0]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]);
+			adjacentVertices[1]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]);
+			adjacentVertices[2]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]);
+			adjacentVertices[3]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]);
+		}
+		else if(findpos(actuelposition,possibleposition[14])){
+			adjacentVertices[0]=&listOfVerticesP2[12]; //graphVertex(possibleposition[12]);
+			adjacentVertices[1]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);
+			adjacentVertices[2]=&listOfVerticesP2[15]; //graphVertex(possibleposition[15]);
+		}
+		else if(findpos(actuelposition,possibleposition[15])){
+			adjacentVertices[0]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]);
+			adjacentVertices[1]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]);
+		}
+		else if(findpos(actuelposition,possibleposition[16])){
+			adjacentVertices[0]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);
+			adjacentVertices[1]=&listOfVerticesP2[15]; //graphVertex(possibleposition[15]);
+			adjacentVertices[2]=&listOfVerticesP2[62]; //graphVertex(possibleposition[62]);
+		}
+		else if(findpos(actuelposition,possibleposition[17])){
+			adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]);
+			adjacentVertices[1]=&listOfVerticesP2[25]; //graphVertex(possibleposition[25]);
+		}
+		else if(findpos(actuelposition,possibleposition[18])){
+			adjacentVertices[0]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]);
+			adjacentVertices[1]=&listOfVerticesP2[24]; //graphVertex(possibleposition[24]);                
+		}
+		else if(findpos(actuelposition,possibleposition[19])){
+			adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]);
+			adjacentVertices[1]=&listOfVerticesP2[18]; //graphVertex(possibleposition[18]);
+			adjacentVertices[2]=&listOfVerticesP2[20]; //graphVertex(possibleposition[20]);
+		}
+		else if(findpos(actuelposition,possibleposition[20])){
+			adjacentVertices[0]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]);
+			adjacentVertices[1]=&listOfVerticesP2[21]; //graphVertex(possibleposition[21]);
+		}
+		else if(findpos(actuelposition,possibleposition[21])){
+			adjacentVertices[0]=&listOfVerticesP2[20]; //graphVertex(possibleposition[20]);
+			adjacentVertices[1]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]);
+		}
+		else if(findpos(actuelposition,possibleposition[22])){
+			adjacentVertices[0]=&listOfVerticesP2[21]; //graphVertex(possibleposition[21]);
+			adjacentVertices[1]=&listOfVerticesP2[23]; //graphVertex(possibleposition[23]);
+			adjacentVertices[2]=&listOfVerticesP2[31]; //graphVertex(possibleposition[31]);
+		}
+		else if(findpos(actuelposition,possibleposition[23])){
+			adjacentVertices[0]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]);
+			adjacentVertices[1]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]);
+		}
+		else if(findpos(actuelposition,possibleposition[24])){
+			adjacentVertices[0]=&listOfVerticesP2[18]; //graphVertex(possibleposition[18]);
+			adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]);
+		}
+		else if(findpos(actuelposition,possibleposition[25])){
+			adjacentVertices[0]=&listOfVerticesP2[17]; //graphVertex(possibleposition[17]);
+			adjacentVertices[1]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]);
+		}
+		else if(findpos(actuelposition,possibleposition[26])){
+			adjacentVertices[0]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]);
+			adjacentVertices[1]=&listOfVerticesP2[25]; //graphVertex(possibleposition[25]);
+			adjacentVertices[2]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]);
+		}
+		else if(findpos(actuelposition,possibleposition[27])){
+			adjacentVertices[0]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]);
+			adjacentVertices[1]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]);
+			adjacentVertices[2]=&listOfVerticesP2[37]; //graphVertex(possibleposition[37]);
+		}
+		else if(findpos(actuelposition,possibleposition[28])){
+			adjacentVertices[0]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]);
+			adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]);
+			adjacentVertices[2]=&listOfVerticesP2[36]; //graphVertex(possibleposition[36]);
+		}
+		else if(findpos(actuelposition,possibleposition[29])){
+			adjacentVertices[0]=&listOfVerticesP2[24]; //graphVertex(possibleposition[24]);
+			adjacentVertices[1]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]);
+			adjacentVertices[2]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]);
+		}
+		else if(findpos(actuelposition,possibleposition[30])){
+			adjacentVertices[0]=&listOfVerticesP2[23]; //graphVertex(possibleposition[23]);
+			adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]);
+			adjacentVertices[2]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);
+		}
+		else if(findpos(actuelposition,possibleposition[31])){
+			adjacentVertices[0]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]);
+			adjacentVertices[1]=&listOfVerticesP2[32]; //graphVertex(possibleposition[32]);
+		}
+		else if(findpos(actuelposition,possibleposition[32])){
+			adjacentVertices[0]=&listOfVerticesP2[31]; //graphVertex(possibleposition[31]);
+			adjacentVertices[1]=&listOfVerticesP2[33]; //graphVertex(possibleposition[33]);
+		}
+		else if(findpos(actuelposition,possibleposition[33])){
+			adjacentVertices[0]=&listOfVerticesP2[32]; //graphVertex(possibleposition[32]);
+			adjacentVertices[1]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);
+		}
+		else if(findpos(actuelposition,possibleposition[34])){
+			adjacentVertices[0]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]);
+			adjacentVertices[1]=&listOfVerticesP2[33]; //graphVertex(possibleposition[33]);
+			adjacentVertices[2]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);
+			adjacentVertices[3]=&listOfVerticesP2[42]; //graphVertex(possibleposition[42]);
 
-        Vector3 listOfNeighboors[4];
-        //first element is south, 2nd west, 3d north, 4th east
+		}
+		else if(findpos(actuelposition,possibleposition[35])){
+			adjacentVertices[0]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);
+			adjacentVertices[1]=&listOfVerticesP2[36]; //graphVertex(possibleposition[36]);
+			adjacentVertices[2]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);
+		}
+		else if(findpos(actuelposition,possibleposition[36])){
+			adjacentVertices[0]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]);
+			adjacentVertices[1]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);
+		}
+		else if(findpos(actuelposition,possibleposition[37])){
+			adjacentVertices[0]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]);
+			adjacentVertices[1]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]);
+		}
+		else if(findpos(actuelposition,possibleposition[38])){
+			adjacentVertices[0]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);
+			adjacentVertices[1]=&listOfVerticesP2[37]; //graphVertex(possibleposition[37]);
+			adjacentVertices[2]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]);
+		}
+		else if(findpos(actuelposition,possibleposition[39])){
+			adjacentVertices[0]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]);
+			adjacentVertices[1]=&listOfVerticesP2[40]; //graphVertex(possibleposition[40]);
+			adjacentVertices[2]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]);
+		}
+		else if(findpos(actuelposition,possibleposition[40])){
+			adjacentVertices[0]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]);
+			adjacentVertices[1]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);
+		}
+		else if(findpos(actuelposition,possibleposition[41])){
+			adjacentVertices[0]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);
+			adjacentVertices[1]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);
+			adjacentVertices[2]=&listOfVerticesP2[40]; //error meuh
+		}
+		else if(findpos(actuelposition,possibleposition[42])){
+			adjacentVertices[0]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);
+			adjacentVertices[1]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);
+			adjacentVertices[2]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]);
+		}
+		else if(findpos(actuelposition,possibleposition[43])){
+			adjacentVertices[0]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);
+			adjacentVertices[1]=&listOfVerticesP2[46]; //graphVertex(possibleposition[46]);
+			adjacentVertices[2]=&listOfVerticesP2[42]; //error meuh
+		}
+		else if(findpos(actuelposition,possibleposition[44])){
+			adjacentVertices[0]=&listOfVerticesP2[40]; //graphVertex(possibleposition[40]);
+			adjacentVertices[1]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]);
+		}
+		else if(findpos(actuelposition,possibleposition[45])){
+			adjacentVertices[0]=&listOfVerticesP2[10]; //graphVertex(possibleposition[10]);
+			adjacentVertices[1]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]);
+			adjacentVertices[2]=&listOfVerticesP2[49]; //graphVertex(possibleposition[49]);
+		}
+		else if(findpos(actuelposition,possibleposition[46])){
+			adjacentVertices[0]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);
+			adjacentVertices[1]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]);
+		}
+		else if(findpos(actuelposition,possibleposition[47])){
+			adjacentVertices[0]=&listOfVerticesP2[46]; //graphVertex(possibleposition[46]);
+			adjacentVertices[1]=&listOfVerticesP2[52]; //graphVertex(possibleposition[52]);
+			adjacentVertices[2]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]);
+		}
+		else if(findpos(actuelposition,possibleposition[48])){
+			adjacentVertices[0]=&listOfVerticesP2[49]; //graphVertex(possibleposition[49]);
+			adjacentVertices[1]=&listOfVerticesP2[51]; //graphVertex(possibleposition[51]);
+			adjacentVertices[2]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]);
+		}
+		else if(findpos(actuelposition,possibleposition[49])){
+			adjacentVertices[0]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]);
+			adjacentVertices[1]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]);
+		}
+		else if(findpos(actuelposition,possibleposition[50])){
+			adjacentVertices[0]=&listOfVerticesP2[51]; //graphVertex(possibleposition[51]);
+			adjacentVertices[1]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]);
+		}
+		else if(findpos(actuelposition,possibleposition[51])){
+			adjacentVertices[0]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]);
+			adjacentVertices[1]=&listOfVerticesP2[50]; //graphVertex(possibleposition[50]);
+		}
+		else if(findpos(actuelposition,possibleposition[52])){
+			adjacentVertices[0]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]);
+			adjacentVertices[1]=&listOfVerticesP2[53]; //graphVertex(possibleposition[53]);
+		}
+		else if(findpos(actuelposition,possibleposition[53])){
+			adjacentVertices[0]=&listOfVerticesP2[52]; //graphVertex(possibleposition[52]);
+			adjacentVertices[1]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);
+		}
+		else if(findpos(actuelposition,possibleposition[54])){
+			adjacentVertices[0]=&listOfVerticesP2[42]; //graphVertex(possibleposition[42]);
+			adjacentVertices[1]=&listOfVerticesP2[55]; //graphVertex(possibleposition[55]);
+			adjacentVertices[2]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);
+		}
+		else if(findpos(actuelposition,possibleposition[55])){
+			adjacentVertices[0]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]);
+			adjacentVertices[1]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]);
+		}
+		else if(findpos(actuelposition,possibleposition[56])){
+			adjacentVertices[0]=&listOfVerticesP2[55]; //graphVertex(possibleposition[55]);
+			adjacentVertices[1]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);
+			adjacentVertices[2]=&listOfVerticesP2[65]; //graphVertex(possibleposition[65]);
+		}
+		else if(findpos(actuelposition,possibleposition[57])){
+			adjacentVertices[0]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]);
+			adjacentVertices[1]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]);
+			adjacentVertices[2]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);
+			adjacentVertices[3]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]);
 
-            if(findpos(pacLasVisPos,possibleposition[0])){
-                //no south neighbor 
-                listOfNeighboors[1]=possibleposition[19]; // west neighbor
-                listOfNeighboors[2]=possibleposition[17]; //north
-                listOfNeighboors[3]=possibleposition[1]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[1])){
-                listOfNeighboors[1]=possibleposition[0]; // west neighbor
-                listOfNeighboors[2]=possibleposition[2]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[2])){
-                listOfNeighboors[0]=possibleposition[1];  //south
-                listOfNeighboors[1]=possibleposition[3]; //west
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[3])){
-                listOfNeighboors[1]=possibleposition[4]; //west
-                listOfNeighboors[2]=possibleposition[5]; //north
-                listOfNeighboors[3]=possibleposition[2]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[4])){
-                listOfNeighboors[2]=possibleposition[6]; //north
-                listOfNeighboors[3]=possibleposition[3]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[5])){
-                listOfNeighboors[0]=possibleposition[3]; //south
-                listOfNeighboors[3]=possibleposition[7]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[6])){
-                listOfNeighboors[0]=possibleposition[4]; //south
-                listOfNeighboors[1]=possibleposition[26]; //west
-                listOfNeighboors[2]=possibleposition[9]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[7])){
-                listOfNeighboors[1]=possibleposition[5]; //west
-                listOfNeighboors[2]=possibleposition[8]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[8])){
-                listOfNeighboors[0]=possibleposition[7]; //south
-                listOfNeighboors[1]=possibleposition[9]; //west
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[9])){
-                listOfNeighboors[0]=possibleposition[6]; //south
-                listOfNeighboors[1]=possibleposition[38]; //west
-                listOfNeighboors[2]=possibleposition[10]; //north
-                listOfNeighboors[3]=possibleposition[8]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[10])){
+		}
+		else if(findpos(actuelposition,possibleposition[58])){
+			adjacentVertices[0]=&listOfVerticesP2[53]; //graphVertex(possibleposition[53]);
+			adjacentVertices[1]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);
+			adjacentVertices[2]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);
+		}
+		else if(findpos(actuelposition,possibleposition[59])){
+			adjacentVertices[0]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);
+			adjacentVertices[1]=&listOfVerticesP2[60]; //graphVertex(possibleposition[59]);
+			adjacentVertices[2]=&listOfVerticesP2[63]; //graphVertex(possibleposition[63]);
+		}
+		else if(findpos(actuelposition,possibleposition[60])){
+			adjacentVertices[0]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);
+			adjacentVertices[1]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]);
+			adjacentVertices[2]=&listOfVerticesP2[62]; //graphVertex(possibleposition[62]);
+		}
+		else if(findpos(actuelposition,possibleposition[61])){
+			adjacentVertices[0]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);
+			adjacentVertices[1]=&listOfVerticesP2[50]; //graphVertex(possibleposition[50]);
+			adjacentVertices[2]=&listOfVerticesP2[60]; //graphVertex(possibleposition[60]);
+		}
+		else if(findpos(actuelposition,possibleposition[62])){
+			adjacentVertices[0]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]);
+			adjacentVertices[1]=&listOfVerticesP2[60]; //graphVertex(possibleposition[60]);
+		}
+		else if(findpos(actuelposition,possibleposition[63])){
+			adjacentVertices[0]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);
+			adjacentVertices[1]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]);
+		}
+		else if(findpos(actuelposition,possibleposition[64])){
+			adjacentVertices[0]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);
+			adjacentVertices[1]=&listOfVerticesP2[63]; //graphVertex(possibleposition[63]);
+			adjacentVertices[2]=&listOfVerticesP2[65]; //graphVertex(possibleposition[65]);
+		}
+		else if(findpos(actuelposition,possibleposition[65])){
+			adjacentVertices[0]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]);
+			adjacentVertices[1]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]);
+		}
+		else if(findpos(actuelposition,possibleposition[66])){
+			adjacentVertices[0]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]);
+			adjacentVertices[1]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]);
+		}
+	}
 
-                if(indexForSWNE==3){ //nothing eastward
-                    return pacLasVisPos;
-                }
+	//functions taken from PacmanPink
+	///////////////////////
 
-                listOfNeighboors[0]=possibleposition[9]; //south
-                listOfNeighboors[1]=possibleposition[45]; //west
-                listOfNeighboors[2]=possibleposition[11]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[11])){
-                listOfNeighboors[0]=possibleposition[10]; //south
-                listOfNeighboors[2]=possibleposition[13]; //north
-                listOfNeighboors[3]=possibleposition[12]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[12])){
-                listOfNeighboors[1]=possibleposition[11]; //west
-                listOfNeighboors[2]=possibleposition[14]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[13])){
-                listOfNeighboors[0]=possibleposition[11]; //south
-                listOfNeighboors[1]=possibleposition[61]; //west
-                listOfNeighboors[2]=possibleposition[16]; //north
-                listOfNeighboors[3]=possibleposition[14]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[14])){
-                listOfNeighboors[0]=possibleposition[12]; //south
-                listOfNeighboors[1]=possibleposition[13]; //west
-                listOfNeighboors[2]=possibleposition[15]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[15])){
-                listOfNeighboors[0]=possibleposition[14]; //south
-                listOfNeighboors[1]=possibleposition[16]; //west
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[16])){
-                listOfNeighboors[0]=possibleposition[13]; //south
-                listOfNeighboors[1]=possibleposition[62]; //west
-                listOfNeighboors[2]=possibleposition[15]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[17])){
-                listOfNeighboors[0]=possibleposition[0]; //south
-                listOfNeighboors[3]=possibleposition[25]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[18])){
-                listOfNeighboors[0]=possibleposition[19]; //south
-                listOfNeighboors[1]=possibleposition[24]; //west
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[19])){
-                listOfNeighboors[1]=possibleposition[20]; //west
-                listOfNeighboors[2]=possibleposition[18]; //north
-                listOfNeighboors[3]=possibleposition[0]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[20])){
-                listOfNeighboors[2]=possibleposition[21]; //north
-                listOfNeighboors[3]=possibleposition[19]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[21])){
-                listOfNeighboors[0]=possibleposition[20]; //south
-                listOfNeighboors[3]=possibleposition[22]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[22])){
-                listOfNeighboors[1]=possibleposition[21]; //west
-                listOfNeighboors[2]=possibleposition[31]; //north
-                listOfNeighboors[3]=possibleposition[23]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[23])){
-                listOfNeighboors[1]=possibleposition[22]; //west
-                listOfNeighboors[2]=possibleposition[30]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[24])){
-                listOfNeighboors[2]=possibleposition[29]; //north
-                listOfNeighboors[3]=possibleposition[18]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[25])){
-                listOfNeighboors[1]=possibleposition[17]; //west
-                listOfNeighboors[2]=possibleposition[26]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[26])){
-                listOfNeighboors[0]=possibleposition[25]; //south
-                listOfNeighboors[1]=possibleposition[27]; //west
-                listOfNeighboors[3]=possibleposition[6]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[27])){
-                listOfNeighboors[1]=possibleposition[28]; //west
-                listOfNeighboors[2]=possibleposition[37]; //north
-                listOfNeighboors[3]=possibleposition[26]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[28])){
-                listOfNeighboors[1]=possibleposition[29]; //west
-                listOfNeighboors[2]=possibleposition[36]; //north
-                listOfNeighboors[3]=possibleposition[27]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[29])){
-                listOfNeighboors[0]=possibleposition[24]; //south
-                listOfNeighboors[1]=possibleposition[30]; //west
-                listOfNeighboors[3]=possibleposition[28]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[30])){
-                listOfNeighboors[0]=possibleposition[23]; //south
-                listOfNeighboors[2]=possibleposition[34]; //north
-                listOfNeighboors[3]=possibleposition[29]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[31])){
-                listOfNeighboors[0]=possibleposition[22]; //south
-                listOfNeighboors[1]=possibleposition[32]; //west
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[32])){
-                listOfNeighboors[2]=possibleposition[33]; //north
-                listOfNeighboors[3]=possibleposition[31]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[33])){
-                listOfNeighboors[0]=possibleposition[32]; //south
-                listOfNeighboors[3]=possibleposition[34]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[34])){
-                listOfNeighboors[0]=possibleposition[30]; //south
-                listOfNeighboors[1]=possibleposition[33]; //west
-                listOfNeighboors[2]=possibleposition[92]; //north
-                listOfNeighboors[3]=possibleposition[35]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[35])){
-                listOfNeighboors[1]=possibleposition[34]; //west
-                listOfNeighboors[2]=possibleposition[91]; //north
-                listOfNeighboors[3]=possibleposition[36]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[36])){
-                listOfNeighboors[0]=possibleposition[28]; //south
-                listOfNeighboors[1]=possibleposition[35]; //west
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[37])){
-                listOfNeighboors[0]=possibleposition[27]; //south
-                listOfNeighboors[3]=possibleposition[38]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[38])){
-                listOfNeighboors[1]=possibleposition[37]; //west
-                listOfNeighboors[2]=possibleposition[39]; //north
-                listOfNeighboors[3]=possibleposition[9]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[39])){
-                listOfNeighboors[0]=possibleposition[38]; //south
-                listOfNeighboors[1]=possibleposition[40]; //west
-                listOfNeighboors[2]=possibleposition[45]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[40])){
-                listOfNeighboors[1]=possibleposition[41]; //west
-                //Not return in center
-                listOfNeighboors[3]=possibleposition[39]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[41])){
-                listOfNeighboors[0]=possibleposition[35]; //south
-                listOfNeighboors[2]=possibleposition[43]; //north
-                listOfNeighboors[3]=possibleposition[40]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[42])){
 
-                if(indexForSWNE==1){//nothing westward
-                    return pacLasVisPos;
-                }
 
-                listOfNeighboors[0]=possibleposition[39]; //south
-                listOfNeighboors[2]=possibleposition[59]; //north
-                listOfNeighboors[3]=possibleposition[43]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[43])){
-                listOfNeighboors[0]=possibleposition[41]; //south
-                listOfNeighboors[1]=possibleposition[42]; //west
-                listOfNeighboors[2]=possibleposition[46]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[44])){
-                listOfNeighboors[0]=possibleposition[40]; //south
-                listOfNeighboors[2]=possibleposition[66]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[45])){
-                listOfNeighboors[0]=possibleposition[39]; //south
-                listOfNeighboors[2]=possibleposition[49]; //north
-                listOfNeighboors[3]=possibleposition[10]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[46])){
-                listOfNeighboors[0]=possibleposition[43]; //south
-                listOfNeighboors[3]=possibleposition[47]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[47])){
-                listOfNeighboors[1]=possibleposition[46]; //west
-                listOfNeighboors[2]=possibleposition[52]; //north
-                listOfNeighboors[3]=possibleposition[66]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[48])){
-                listOfNeighboors[1]=possibleposition[66]; //west
-                listOfNeighboors[2]=possibleposition[51]; //north
-                listOfNeighboors[3]=possibleposition[49]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[49])){
-                listOfNeighboors[0]=possibleposition[45]; //south
-                listOfNeighboors[1]=possibleposition[48]; //west
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[50])){
-                listOfNeighboors[1]=possibleposition[51]; //west
-                listOfNeighboors[2]=possibleposition[61]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[51])){
-                listOfNeighboors[0]=possibleposition[48]; //south
-                listOfNeighboors[3]=possibleposition[50]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[52])){
-                listOfNeighboors[0]=possibleposition[47]; //south
-                listOfNeighboors[1]=possibleposition[53]; //west
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[53])){
-                listOfNeighboors[2]=possibleposition[58]; //north
-                listOfNeighboors[3]=possibleposition[52]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[54])){
-                listOfNeighboors[0]=possibleposition[42]; //south
-                listOfNeighboors[1]=possibleposition[55]; //west
-                listOfNeighboors[2]=possibleposition[57]; //north
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[55])){
-                listOfNeighboors[2]=possibleposition[56]; //north
-                listOfNeighboors[3]=possibleposition[54]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[56])){
-                listOfNeighboors[0]=possibleposition[55]; //south
-                listOfNeighboors[2]=possibleposition[65]; //north
-                listOfNeighboors[3]=possibleposition[57]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[57])){
-                listOfNeighboors[0]=possibleposition[54]; //south
-                listOfNeighboors[1]=possibleposition[56]; //west
-                listOfNeighboors[2]=possibleposition[64]; //north
-                listOfNeighboors[3]=possibleposition[58]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[58])){
-                listOfNeighboors[0]=possibleposition[53]; //south
-                listOfNeighboors[1]=possibleposition[57]; //west
-                listOfNeighboors[3]=possibleposition[59]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[59])){
-                listOfNeighboors[1]=possibleposition[58]; //west
-                listOfNeighboors[2]=possibleposition[63]; //north
-                listOfNeighboors[3]=possibleposition[60]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[60])){
-                listOfNeighboors[1]=possibleposition[59]; //west
-                listOfNeighboors[2]=possibleposition[62]; //north
-                listOfNeighboors[3]=possibleposition[61]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[61])){
-                listOfNeighboors[0]=possibleposition[50]; //south
-                listOfNeighboors[1]=possibleposition[60]; //west
-                listOfNeighboors[3]=possibleposition[13]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[62])){
-                listOfNeighboors[0]=possibleposition[60]; //south
-                listOfNeighboors[3]=possibleposition[16]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[63])){
-                listOfNeighboors[0]=possibleposition[59]; //south
-                listOfNeighboors[1]=possibleposition[64]; //west
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[64])){
-                listOfNeighboors[0]=possibleposition[57]; //south
-                listOfNeighboors[1]=possibleposition[65]; //west
-                listOfNeighboors[3]=possibleposition[63]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[65])){
-                listOfNeighboors[0]=possibleposition[56]; //south
-                listOfNeighboors[3]=possibleposition[64]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);
-            }
-            else if(findpos(pacLasVisPos,possibleposition[66])){
-                //Not back in center
-                listOfNeighboors[1]=possibleposition[47]; //west
-                listOfNeighboors[3]=possibleposition[48]; //east
-                return listOfNeighboors[indexForSWNE]; //Vector3(listOfNeighboors[indexForSWNE].x, 10, listOfNeighboors[indexForSWNE].z);            
-            }
 
-        }
 
+	Vector3 PacmanGhost::frontPosition(){
 
+		Vector3 neighborPos[4] = {Vector3(-1,-1,-1)};
+		Vector3 frontPoint = Vector3(0,-1,0);
 
 
-///////////////////////
+		findNeighboorPositions(this->lastPlayerPassedPoint, neighborPos, possibleposition);
 
+		for(int i=0; i<4; i++){
 
+			if((neighborPos[i]!=Vector3(-1,-1,-1))&&(neighborPos[i].y==10)){
+				//y==10 to ignore many unwanted strange positions that pop up otherwise and create SIGSEV
 
+				if(frontPoint==Vector3(0,-1,0)){
+					frontPoint=neighborPos[i];
 
+				}
+				else if (graphDistance(this->getPlayerPos(), frontPoint)>graphDistance(this->getPlayerPos(), neighborPos[i])){
+					frontPoint=neighborPos[i];
+				}
 
-    Vector3 PacmanGhost::frontPosition(){
+			}
+		}
 
-    Vector3 neighborPos[4] = {Vector3(-1,-1,-1)};
-    Vector3 frontPoint = Vector3(0,-1,0);
+		if(frontPoint==Vector3(0,-1,0)){
+			//default
+			return this->lastPlayerPassedPoint;
+		}
+		else{
+			//std::cout<<frontPoint<<endl;
+			return frontPoint;
+		}
+	}
 
 
-    findNeighboorPositions(this->lastPlayerPassedPoint, neighborPos, possibleposition);
 
-    for(int i=0; i<4; i++){
 
-     if((neighborPos[i]!=Vector3(-1,-1,-1))&&(neighborPos[i].y==10)){
-     //y==10 to ignore many unwanted strange positions that pop up otherwise and create SIGSEV
-        
-        if(frontPoint==Vector3(0,-1,0)){
-            frontPoint=neighborPos[i];
 
-                        }
-        else if (graphDistance(this->getPlayerPos(), frontPoint)>graphDistance(this->getPlayerPos(), neighborPos[i])){
-            frontPoint=neighborPos[i];
-                        }
 
-                    }
-                }
+	void PacmanGhost::findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]){      
+		//this function should put in adjacentPosition[] the neighboors of lastPlayerPastPoint
 
-    if(frontPoint==Vector3(0,-1,0)){
-        //default
-        return this->lastPlayerPassedPoint;
-            }
-    else{
-        //std::cout<<frontPoint<<endl;
-        return frontPoint;
-            }
-    }
+		if(findpos(actuelposition,possibleposition[0])){
 
 
+			adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]);  //need to do it everywhere !!!
+			adjacentPositions[1]=positionArray[17]; //graphVertex(possibleposition[17]);
+			adjacentPositions[2]=positionArray[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ?
+		}
+		else if(findpos(actuelposition,possibleposition[1])){
+			adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
+			adjacentPositions[1]=positionArray[2]; //graphVertex(possibleposition[2]);
+		}
+		else if(findpos(actuelposition,possibleposition[2])){
+			adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]);
+			adjacentPositions[1]=positionArray[3]; //graphVertex(possibleposition[3]);
+		}
+		else if(findpos(actuelposition,possibleposition[3])){
+			adjacentPositions[0]=positionArray[2]; //graphVertex(possibleposition[2]);
+			adjacentPositions[1]=positionArray[4]; //graphVertex(possibleposition[4]);
+			adjacentPositions[2]=positionArray[5]; //graphVertex(possibleposition[5]);
+		}
+		else if(findpos(actuelposition,possibleposition[4])){
+			adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);
+			adjacentPositions[1]=positionArray[6]; //graphVertex(possibleposition[6]);
+		}
+		else if(findpos(actuelposition,possibleposition[5])){
+			adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);
+			adjacentPositions[1]=positionArray[7]; //graphVertex(possibleposition[7]);
+		}
+		else if(findpos(actuelposition,possibleposition[6])){
+			adjacentPositions[0]=positionArray[4]; //graphVertex(possibleposition[4]);
+			adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);
+			adjacentPositions[2]=positionArray[26]; //graphVertex(possibleposition[26]);
+		}
+		else if(findpos(actuelposition,possibleposition[7])){
+			adjacentPositions[0]=positionArray[5]; //graphVertex(possibleposition[5]);
+			adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);
+		}
+		else if(findpos(actuelposition,possibleposition[8])){
+			adjacentPositions[0]=positionArray[7]; //graphVertex(possibleposition[7]);
+			adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);
+		}
+		else if(findpos(actuelposition,possibleposition[9])){
+			adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);
+			adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);
+			adjacentPositions[2]=positionArray[10]; //graphVertex(possibleposition[10]);
+			adjacentPositions[3]=positionArray[38]; //graphVertex(possibleposition[38]);
+		}
+		else if(findpos(actuelposition,possibleposition[10])){
+			adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);
+			adjacentPositions[1]=positionArray[11]; //graphVertex(possibleposition[11]);
+			adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);
+		}
+		else if(findpos(actuelposition,possibleposition[11])){
+			adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);
+			adjacentPositions[1]=positionArray[12]; //graphVertex(possibleposition[12]);
+			adjacentPositions[2]=positionArray[13]; //graphVertex(possibleposition[13]);
+		}
+		else if(findpos(actuelposition,possibleposition[12])){
+			adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);
+			adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);
+		}
+		else if(findpos(actuelposition,possibleposition[13])){
+			adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);
+			adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);
+			adjacentPositions[2]=positionArray[16]; //graphVertex(possibleposition[16]);
+			adjacentPositions[3]=positionArray[61]; //graphVertex(possibleposition[61]);
+		}
+		else if(findpos(actuelposition,possibleposition[14])){
+			adjacentPositions[0]=positionArray[12]; //graphVertex(possibleposition[12]);
+			adjacentPositions[1]=positionArray[13]; //graphVertex(possibleposition[13]);
+			adjacentPositions[2]=positionArray[15]; //graphVertex(possibleposition[15]);
+		}
+		else if(findpos(actuelposition,possibleposition[15])){
+			adjacentPositions[0]=positionArray[14]; //graphVertex(possibleposition[14]);
+			adjacentPositions[1]=positionArray[16]; //graphVertex(possibleposition[16]);
+		}
+		else if(findpos(actuelposition,possibleposition[16])){
+			adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);
+			adjacentPositions[1]=positionArray[15]; //graphVertex(possibleposition[15]);
+			adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);
+		}
+		else if(findpos(actuelposition,possibleposition[17])){
+			adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
+			adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);
+		}
+		else if(findpos(actuelposition,possibleposition[18])){
+			adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);
+			adjacentPositions[1]=positionArray[24]; //graphVertex(possibleposition[24]);                
+		}
+		else if(findpos(actuelposition,possibleposition[19])){
+			adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
+			adjacentPositions[1]=positionArray[18]; //graphVertex(possibleposition[18]);
+			adjacentPositions[2]=positionArray[20]; //graphVertex(possibleposition[20]);
+		}
+		else if(findpos(actuelposition,possibleposition[20])){
+			adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);
+			adjacentPositions[1]=positionArray[21]; //graphVertex(possibleposition[21]);
+		}
+		else if(findpos(actuelposition,possibleposition[21])){
+			adjacentPositions[0]=positionArray[20]; //graphVertex(possibleposition[20]);
+			adjacentPositions[1]=positionArray[22]; //graphVertex(possibleposition[22]);
+		}
+		else if(findpos(actuelposition,possibleposition[22])){
+			adjacentPositions[0]=positionArray[21]; //graphVertex(possibleposition[21]);
+			adjacentPositions[1]=positionArray[23]; //graphVertex(possibleposition[23]);
+			adjacentPositions[2]=positionArray[31]; //graphVertex(possibleposition[31]);
+		}
+		else if(findpos(actuelposition,possibleposition[23])){
+			adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);
+			adjacentPositions[1]=positionArray[30]; //graphVertex(possibleposition[30]);
+		}
+		else if(findpos(actuelposition,possibleposition[24])){
+			adjacentPositions[0]=positionArray[18]; //graphVertex(possibleposition[18]);
+			adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
+		}
+		else if(findpos(actuelposition,possibleposition[25])){
+			adjacentPositions[0]=positionArray[17]; //graphVertex(possibleposition[17]);
+			adjacentPositions[1]=positionArray[26]; //graphVertex(possibleposition[26]);
+		}
+		else if(findpos(actuelposition,possibleposition[26])){
+			adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);
+			adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);
+			adjacentPositions[2]=positionArray[27]; //graphVertex(possibleposition[27]);
+		}
+		else if(findpos(actuelposition,possibleposition[27])){
+			adjacentPositions[0]=positionArray[26]; //graphVertex(possibleposition[26]);
+			adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);
+			adjacentPositions[2]=positionArray[37]; //graphVertex(possibleposition[37]);
+		}
+		else if(findpos(actuelposition,possibleposition[28])){
+			adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);
+			adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
+			adjacentPositions[2]=positionArray[36]; //graphVertex(possibleposition[36]);
+		}
+		else if(findpos(actuelposition,possibleposition[29])){
+			adjacentPositions[0]=positionArray[24]; //graphVertex(possibleposition[24]);
+			adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);
+			adjacentPositions[2]=positionArray[30]; //graphVertex(possibleposition[30]);
+		}
+		else if(findpos(actuelposition,possibleposition[30])){
+			adjacentPositions[0]=positionArray[23]; //graphVertex(possibleposition[23]);
+			adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
+			adjacentPositions[2]=positionArray[34]; //graphVertex(possibleposition[34]);
+		}
+		else if(findpos(actuelposition,possibleposition[31])){
+			adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);
+			adjacentPositions[1]=positionArray[32]; //graphVertex(possibleposition[32]);
+		}
+		else if(findpos(actuelposition,possibleposition[32])){
+			adjacentPositions[0]=positionArray[31]; //graphVertex(possibleposition[31]);
+			adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);
+		}
+		else if(findpos(actuelposition,possibleposition[33])){
+			adjacentPositions[0]=positionArray[32]; //graphVertex(possibleposition[32]);
+			adjacentPositions[1]=positionArray[34]; //graphVertex(possibleposition[34]);
+		}
+		else if(findpos(actuelposition,possibleposition[34])){
+			adjacentPositions[0]=positionArray[30]; //graphVertex(possibleposition[30]);
+			adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);
+			adjacentPositions[2]=positionArray[35]; //graphVertex(possibleposition[35]);
+			adjacentPositions[3]=positionArray[42]; //graphVertex(possibleposition[42]);
 
+		}
+		else if(findpos(actuelposition,possibleposition[35])){
+			adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);
+			adjacentPositions[1]=positionArray[36]; //graphVertex(possibleposition[36]);
+			adjacentPositions[2]=positionArray[41]; //graphVertex(possibleposition[41]);
+		}
+		else if(findpos(actuelposition,possibleposition[36])){
+			adjacentPositions[0]=positionArray[28]; //graphVertex(possibleposition[28]);
+			adjacentPositions[1]=positionArray[35]; //graphVertex(possibleposition[35]);
+		}
+		else if(findpos(actuelposition,possibleposition[37])){
+			adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);
+			adjacentPositions[1]=positionArray[38]; //graphVertex(possibleposition[38]);
+		}
+		else if(findpos(actuelposition,possibleposition[38])){
+			adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);
+			adjacentPositions[1]=positionArray[37]; //graphVertex(possibleposition[37]);
+			adjacentPositions[2]=positionArray[39]; //graphVertex(possibleposition[39]);
+		}
+		else if(findpos(actuelposition,possibleposition[39])){
+			adjacentPositions[0]=positionArray[38]; //graphVertex(possibleposition[38]);
+			adjacentPositions[1]=positionArray[40]; //graphVertex(possibleposition[40]);
+			adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);
+		}
+		else if(findpos(actuelposition,possibleposition[40])){
+			adjacentPositions[0]=positionArray[39]; //graphVertex(possibleposition[39]);
+			adjacentPositions[1]=positionArray[41]; //graphVertex(possibleposition[41]);
+		}
+		else if(findpos(actuelposition,possibleposition[41])){
+			adjacentPositions[0]=positionArray[35]; //graphVertex(possibleposition[35]);
+			adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);
+			adjacentPositions[2]=positionArray[40];  //error 
+		}
+		else if(findpos(actuelposition,possibleposition[42])){
+			adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);
+			adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);
+			adjacentPositions[2]=positionArray[54]; //graphVertex(possibleposition[54]);
+		}
+		else if(findpos(actuelposition,possibleposition[43])){
+			adjacentPositions[0]=positionArray[41]; //graphVertex(possibleposition[41]);
+			adjacentPositions[1]=positionArray[46]; //graphVertex(possibleposition[46]);
+			adjacentPositions[2]=positionArray[42]; //error
+		}
+		else if(findpos(actuelposition,possibleposition[44])){
+			adjacentPositions[0]=positionArray[40]; //graphVertex(possibleposition[40]);
+			adjacentPositions[1]=positionArray[66]; //graphVertex(possibleposition[66]);
+		}
+		else if(findpos(actuelposition,possibleposition[45])){
+			adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);
+			adjacentPositions[1]=positionArray[39]; //graphVertex(possibleposition[39]);
+			adjacentPositions[2]=positionArray[49]; //graphVertex(possibleposition[49]);
+		}
+		else if(findpos(actuelposition,possibleposition[46])){
+			adjacentPositions[0]=positionArray[43]; //graphVertex(possibleposition[43]);
+			adjacentPositions[1]=positionArray[47]; //graphVertex(possibleposition[47]);
+		}
+		else if(findpos(actuelposition,possibleposition[47])){
+			adjacentPositions[0]=positionArray[46]; //graphVertex(possibleposition[46]);
+			adjacentPositions[1]=positionArray[52]; //graphVertex(possibleposition[52]);
+			adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);
+		}
+		else if(findpos(actuelposition,possibleposition[48])){
+			adjacentPositions[0]=positionArray[49]; //graphVertex(possibleposition[49]);
+			adjacentPositions[1]=positionArray[51]; //graphVertex(possibleposition[51]);
+			adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);
+		}
+		else if(findpos(actuelposition,possibleposition[49])){
+			adjacentPositions[0]=positionArray[45]; //graphVertex(possibleposition[45]);
+			adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);
+		}
+		else if(findpos(actuelposition,possibleposition[50])){
+			adjacentPositions[0]=positionArray[51]; //graphVertex(possibleposition[51]);
+			adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);
+		}
+		else if(findpos(actuelposition,possibleposition[51])){
+			adjacentPositions[0]=positionArray[48]; //graphVertex(possibleposition[48]);
+			adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);
+		}
+		else if(findpos(actuelposition,possibleposition[52])){
+			adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);
+			adjacentPositions[1]=positionArray[53]; //graphVertex(possibleposition[53]);
+		}
+		else if(findpos(actuelposition,possibleposition[53])){
+			adjacentPositions[0]=positionArray[52]; //graphVertex(possibleposition[52]);
+			adjacentPositions[1]=positionArray[58]; //graphVertex(possibleposition[58]);
+		}
+		else if(findpos(actuelposition,possibleposition[54])){
+			adjacentPositions[0]=positionArray[42]; //graphVertex(possibleposition[42]);
+			adjacentPositions[1]=positionArray[55]; //graphVertex(possibleposition[55]);
+			adjacentPositions[2]=positionArray[57]; //graphVertex(possibleposition[57]);
+		}
+		else if(findpos(actuelposition,possibleposition[55])){
+			adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);
+			adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);
+		}
+		else if(findpos(actuelposition,possibleposition[56])){
+			adjacentPositions[0]=positionArray[55]; //graphVertex(possibleposition[55]);
+			adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);
+			adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);
+		}
+		else if(findpos(actuelposition,possibleposition[57])){
+			adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);
+			adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);
+			adjacentPositions[2]=positionArray[58]; //graphVertex(possibleposition[58]);
+			adjacentPositions[3]=positionArray[64]; //graphVertex(possibleposition[64]);
 
+		}
+		else if(findpos(actuelposition,possibleposition[58])){
+			adjacentPositions[0]=positionArray[53]; //graphVertex(possibleposition[53]);
+			adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);
+			adjacentPositions[2]=positionArray[59]; //graphVertex(possibleposition[59]);
+		}
+		else if(findpos(actuelposition,possibleposition[59])){
+			adjacentPositions[0]=positionArray[58]; //graphVertex(possibleposition[58]);
+			adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]); //error 59
+			adjacentPositions[2]=positionArray[63]; //graphVertex(possibleposition[63]);
+		}
+		else if(findpos(actuelposition,possibleposition[60])){
+			adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);
+			adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);
+			adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);
+		}
+		else if(findpos(actuelposition,possibleposition[61])){
+			adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);
+			adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);
+			adjacentPositions[2]=positionArray[60]; //graphVertex(possibleposition[60]);
+		}
+		else if(findpos(actuelposition,possibleposition[62])){
+			adjacentPositions[0]=positionArray[16]; //graphVertex(possibleposition[16]);
+			adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]);
+		}
+		else if(findpos(actuelposition,possibleposition[63])){
+			adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);
+			adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);
+		}
+		else if(findpos(actuelposition,possibleposition[64])){
+			adjacentPositions[0]=positionArray[57]; //graphVertex(possibleposition[57]);
+			adjacentPositions[1]=positionArray[63]; //graphVertex(possibleposition[63]);
+			adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);
+		}
+		else if(findpos(actuelposition,possibleposition[65])){
+			adjacentPositions[0]=positionArray[56]; //graphVertex(possibleposition[56]);
+			adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);
+		}
+		else if(findpos(actuelposition,possibleposition[66])){
+			adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);
+			adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);
+		}
+	}
 
 
-    void PacmanGhost::findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]){      
-            //this function should put in adjacentPosition[] the neighboors of lastPlayerPastPoint
-
-            if(findpos(actuelposition,possibleposition[0])){
-                
-
-                adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]);  //need to do it everywhere !!!
-                adjacentPositions[1]=positionArray[17]; //graphVertex(possibleposition[17]);
-                adjacentPositions[2]=positionArray[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ?
-            }
-            else if(findpos(actuelposition,possibleposition[1])){
-                adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
-                adjacentPositions[1]=positionArray[2]; //graphVertex(possibleposition[2]);
-            }
-            else if(findpos(actuelposition,possibleposition[2])){
-                adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]);
-                adjacentPositions[1]=positionArray[3]; //graphVertex(possibleposition[3]);
-            }
-            else if(findpos(actuelposition,possibleposition[3])){
-                adjacentPositions[0]=positionArray[2]; //graphVertex(possibleposition[2]);
-                adjacentPositions[1]=positionArray[4]; //graphVertex(possibleposition[4]);
-                adjacentPositions[2]=positionArray[5]; //graphVertex(possibleposition[5]);
-            }
-            else if(findpos(actuelposition,possibleposition[4])){
-                adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);
-                adjacentPositions[1]=positionArray[6]; //graphVertex(possibleposition[6]);
-            }
-            else if(findpos(actuelposition,possibleposition[5])){
-                adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);
-                adjacentPositions[1]=positionArray[7]; //graphVertex(possibleposition[7]);
-            }
-            else if(findpos(actuelposition,possibleposition[6])){
-                adjacentPositions[0]=positionArray[4]; //graphVertex(possibleposition[4]);
-                adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);
-                adjacentPositions[2]=positionArray[26]; //graphVertex(possibleposition[26]);
-            }
-            else if(findpos(actuelposition,possibleposition[7])){
-                adjacentPositions[0]=positionArray[5]; //graphVertex(possibleposition[5]);
-                adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);
-            }
-            else if(findpos(actuelposition,possibleposition[8])){
-                adjacentPositions[0]=positionArray[7]; //graphVertex(possibleposition[7]);
-                adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);
-            }
-            else if(findpos(actuelposition,possibleposition[9])){
-                adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);
-                adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);
-                adjacentPositions[2]=positionArray[10]; //graphVertex(possibleposition[10]);
-                adjacentPositions[3]=positionArray[38]; //graphVertex(possibleposition[38]);
-            }
-            else if(findpos(actuelposition,possibleposition[10])){
-                adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);
-                adjacentPositions[1]=positionArray[11]; //graphVertex(possibleposition[11]);
-                adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);
-            }
-            else if(findpos(actuelposition,possibleposition[11])){
-                adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);
-                adjacentPositions[1]=positionArray[12]; //graphVertex(possibleposition[12]);
-                adjacentPositions[2]=positionArray[13]; //graphVertex(possibleposition[13]);
-            }
-            else if(findpos(actuelposition,possibleposition[12])){
-                adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);
-                adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);
-            }
-            else if(findpos(actuelposition,possibleposition[13])){
-                adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);
-                adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);
-                adjacentPositions[2]=positionArray[16]; //graphVertex(possibleposition[16]);
-                adjacentPositions[3]=positionArray[61]; //graphVertex(possibleposition[61]);
-            }
-            else if(findpos(actuelposition,possibleposition[14])){
-                adjacentPositions[0]=positionArray[12]; //graphVertex(possibleposition[12]);
-                adjacentPositions[1]=positionArray[13]; //graphVertex(possibleposition[13]);
-                adjacentPositions[2]=positionArray[15]; //graphVertex(possibleposition[15]);
-            }
-            else if(findpos(actuelposition,possibleposition[15])){
-                adjacentPositions[0]=positionArray[14]; //graphVertex(possibleposition[14]);
-                adjacentPositions[1]=positionArray[16]; //graphVertex(possibleposition[16]);
-            }
-            else if(findpos(actuelposition,possibleposition[16])){
-                adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);
-                adjacentPositions[1]=positionArray[15]; //graphVertex(possibleposition[15]);
-                adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);
-            }
-            else if(findpos(actuelposition,possibleposition[17])){
-                adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
-                adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);
-            }
-            else if(findpos(actuelposition,possibleposition[18])){
-                adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);
-                adjacentPositions[1]=positionArray[24]; //graphVertex(possibleposition[24]);                
-            }
-            else if(findpos(actuelposition,possibleposition[19])){
-                adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
-                adjacentPositions[1]=positionArray[18]; //graphVertex(possibleposition[18]);
-                adjacentPositions[2]=positionArray[20]; //graphVertex(possibleposition[20]);
-                         }
-            else if(findpos(actuelposition,possibleposition[20])){
-                adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);
-                adjacentPositions[1]=positionArray[21]; //graphVertex(possibleposition[21]);
-                       }
-            else if(findpos(actuelposition,possibleposition[21])){
-                adjacentPositions[0]=positionArray[20]; //graphVertex(possibleposition[20]);
-                adjacentPositions[1]=positionArray[22]; //graphVertex(possibleposition[22]);
-                       }
-            else if(findpos(actuelposition,possibleposition[22])){
-                adjacentPositions[0]=positionArray[21]; //graphVertex(possibleposition[21]);
-                adjacentPositions[1]=positionArray[23]; //graphVertex(possibleposition[23]);
-                adjacentPositions[2]=positionArray[31]; //graphVertex(possibleposition[31]);
-                          }
-            else if(findpos(actuelposition,possibleposition[23])){
-                adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);
-                adjacentPositions[1]=positionArray[30]; //graphVertex(possibleposition[30]);
-                       }
-            else if(findpos(actuelposition,possibleposition[24])){
-                adjacentPositions[0]=positionArray[18]; //graphVertex(possibleposition[18]);
-                adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
-                       }
-            else if(findpos(actuelposition,possibleposition[25])){
-                adjacentPositions[0]=positionArray[17]; //graphVertex(possibleposition[17]);
-                adjacentPositions[1]=positionArray[26]; //graphVertex(possibleposition[26]);
-                       }
-            else if(findpos(actuelposition,possibleposition[26])){
-                adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);
-                adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);
-                adjacentPositions[2]=positionArray[27]; //graphVertex(possibleposition[27]);
-                         }
-            else if(findpos(actuelposition,possibleposition[27])){
-                adjacentPositions[0]=positionArray[26]; //graphVertex(possibleposition[26]);
-                adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);
-                adjacentPositions[2]=positionArray[37]; //graphVertex(possibleposition[37]);
-                          }
-            else if(findpos(actuelposition,possibleposition[28])){
-                adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);
-                adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
-                adjacentPositions[2]=positionArray[36]; //graphVertex(possibleposition[36]);
-                          }
-            else if(findpos(actuelposition,possibleposition[29])){
-                adjacentPositions[0]=positionArray[24]; //graphVertex(possibleposition[24]);
-                adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);
-                adjacentPositions[2]=positionArray[30]; //graphVertex(possibleposition[30]);
-                          }
-            else if(findpos(actuelposition,possibleposition[30])){
-                adjacentPositions[0]=positionArray[23]; //graphVertex(possibleposition[23]);
-                adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
-                adjacentPositions[2]=positionArray[34]; //graphVertex(possibleposition[34]);
-                          }
-            else if(findpos(actuelposition,possibleposition[31])){
-                adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);
-                adjacentPositions[1]=positionArray[32]; //graphVertex(possibleposition[32]);
-                       }
-            else if(findpos(actuelposition,possibleposition[32])){
-                adjacentPositions[0]=positionArray[31]; //graphVertex(possibleposition[31]);
-                adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);
-                       }
-            else if(findpos(actuelposition,possibleposition[33])){
-                adjacentPositions[0]=positionArray[32]; //graphVertex(possibleposition[32]);
-                adjacentPositions[1]=positionArray[34]; //graphVertex(possibleposition[34]);
-                       }
-            else if(findpos(actuelposition,possibleposition[34])){
-                adjacentPositions[0]=positionArray[30]; //graphVertex(possibleposition[30]);
-                adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);
-                adjacentPositions[2]=positionArray[35]; //graphVertex(possibleposition[35]);
-                adjacentPositions[3]=positionArray[42]; //graphVertex(possibleposition[42]);
-                
-            }
-            else if(findpos(actuelposition,possibleposition[35])){
-                adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);
-                adjacentPositions[1]=positionArray[36]; //graphVertex(possibleposition[36]);
-                adjacentPositions[2]=positionArray[41]; //graphVertex(possibleposition[41]);
-                          }
-            else if(findpos(actuelposition,possibleposition[36])){
-                adjacentPositions[0]=positionArray[28]; //graphVertex(possibleposition[28]);
-                adjacentPositions[1]=positionArray[35]; //graphVertex(possibleposition[35]);
-                       }
-            else if(findpos(actuelposition,possibleposition[37])){
-                adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);
-                adjacentPositions[1]=positionArray[38]; //graphVertex(possibleposition[38]);
-                       }
-            else if(findpos(actuelposition,possibleposition[38])){
-                adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);
-                adjacentPositions[1]=positionArray[37]; //graphVertex(possibleposition[37]);
-                adjacentPositions[2]=positionArray[39]; //graphVertex(possibleposition[39]);
-                         }
-            else if(findpos(actuelposition,possibleposition[39])){
-                adjacentPositions[0]=positionArray[38]; //graphVertex(possibleposition[38]);
-                adjacentPositions[1]=positionArray[40]; //graphVertex(possibleposition[40]);
-                adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);
-                          }
-            else if(findpos(actuelposition,possibleposition[40])){
-                adjacentPositions[0]=positionArray[39]; //graphVertex(possibleposition[39]);
-                adjacentPositions[1]=positionArray[41]; //graphVertex(possibleposition[41]);
-            }
-            else if(findpos(actuelposition,possibleposition[41])){
-                adjacentPositions[0]=positionArray[35]; //graphVertex(possibleposition[35]);
-                adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);
-                adjacentPositions[2]=positionArray[40];  //error 
-                       }
-            else if(findpos(actuelposition,possibleposition[42])){
-                adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);
-                adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);
-                adjacentPositions[2]=positionArray[54]; //graphVertex(possibleposition[54]);
-                          }
-            else if(findpos(actuelposition,possibleposition[43])){
-                adjacentPositions[0]=positionArray[41]; //graphVertex(possibleposition[41]);
-                adjacentPositions[1]=positionArray[46]; //graphVertex(possibleposition[46]);
-                adjacentPositions[2]=positionArray[42]; //error
-                       }
-            else if(findpos(actuelposition,possibleposition[44])){
-                adjacentPositions[0]=positionArray[40]; //graphVertex(possibleposition[40]);
-                adjacentPositions[1]=positionArray[66]; //graphVertex(possibleposition[66]);
-                       }
-            else if(findpos(actuelposition,possibleposition[45])){
-                adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);
-                adjacentPositions[1]=positionArray[39]; //graphVertex(possibleposition[39]);
-                adjacentPositions[2]=positionArray[49]; //graphVertex(possibleposition[49]);
-                          }
-            else if(findpos(actuelposition,possibleposition[46])){
-                adjacentPositions[0]=positionArray[43]; //graphVertex(possibleposition[43]);
-                adjacentPositions[1]=positionArray[47]; //graphVertex(possibleposition[47]);
-                       }
-            else if(findpos(actuelposition,possibleposition[47])){
-                adjacentPositions[0]=positionArray[46]; //graphVertex(possibleposition[46]);
-                adjacentPositions[1]=positionArray[52]; //graphVertex(possibleposition[52]);
-                adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);
-                          }
-            else if(findpos(actuelposition,possibleposition[48])){
-                adjacentPositions[0]=positionArray[49]; //graphVertex(possibleposition[49]);
-                adjacentPositions[1]=positionArray[51]; //graphVertex(possibleposition[51]);
-                adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);
-                          }
-            else if(findpos(actuelposition,possibleposition[49])){
-                adjacentPositions[0]=positionArray[45]; //graphVertex(possibleposition[45]);
-                adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);
-                       }
-            else if(findpos(actuelposition,possibleposition[50])){
-                adjacentPositions[0]=positionArray[51]; //graphVertex(possibleposition[51]);
-                adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);
-                       }
-            else if(findpos(actuelposition,possibleposition[51])){
-                adjacentPositions[0]=positionArray[48]; //graphVertex(possibleposition[48]);
-                adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);
-                       }
-            else if(findpos(actuelposition,possibleposition[52])){
-                adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);
-                adjacentPositions[1]=positionArray[53]; //graphVertex(possibleposition[53]);
-                       }
-            else if(findpos(actuelposition,possibleposition[53])){
-                adjacentPositions[0]=positionArray[52]; //graphVertex(possibleposition[52]);
-                adjacentPositions[1]=positionArray[58]; //graphVertex(possibleposition[58]);
-                       }
-            else if(findpos(actuelposition,possibleposition[54])){
-                adjacentPositions[0]=positionArray[42]; //graphVertex(possibleposition[42]);
-                adjacentPositions[1]=positionArray[55]; //graphVertex(possibleposition[55]);
-                adjacentPositions[2]=positionArray[57]; //graphVertex(possibleposition[57]);
-                          }
-            else if(findpos(actuelposition,possibleposition[55])){
-                adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);
-                adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);
-                       }
-            else if(findpos(actuelposition,possibleposition[56])){
-                adjacentPositions[0]=positionArray[55]; //graphVertex(possibleposition[55]);
-                adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);
-                adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);
-                          }
-            else if(findpos(actuelposition,possibleposition[57])){
-                adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);
-                adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);
-                adjacentPositions[2]=positionArray[58]; //graphVertex(possibleposition[58]);
-                adjacentPositions[3]=positionArray[64]; //graphVertex(possibleposition[64]);
-                
-            }
-            else if(findpos(actuelposition,possibleposition[58])){
-                adjacentPositions[0]=positionArray[53]; //graphVertex(possibleposition[53]);
-                adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);
-                adjacentPositions[2]=positionArray[59]; //graphVertex(possibleposition[59]);
-                          }
-            else if(findpos(actuelposition,possibleposition[59])){
-                adjacentPositions[0]=positionArray[58]; //graphVertex(possibleposition[58]);
-                adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]); //error 59
-                adjacentPositions[2]=positionArray[63]; //graphVertex(possibleposition[63]);
-                          }
-            else if(findpos(actuelposition,possibleposition[60])){
-                adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);
-                adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);
-                adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);
-                          }
-            else if(findpos(actuelposition,possibleposition[61])){
-                adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);
-                adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);
-                adjacentPositions[2]=positionArray[60]; //graphVertex(possibleposition[60]);
-                          }
-            else if(findpos(actuelposition,possibleposition[62])){
-                adjacentPositions[0]=positionArray[16]; //graphVertex(possibleposition[16]);
-                adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]);
-                       }
-            else if(findpos(actuelposition,possibleposition[63])){
-                adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);
-                adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);
-                       }
-            else if(findpos(actuelposition,possibleposition[64])){
-                adjacentPositions[0]=positionArray[57]; //graphVertex(possibleposition[57]);
-                adjacentPositions[1]=positionArray[63]; //graphVertex(possibleposition[63]);
-                adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);
-                          }
-            else if(findpos(actuelposition,possibleposition[65])){
-                adjacentPositions[0]=positionArray[56]; //graphVertex(possibleposition[56]);
-                adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);
-                       }
-            else if(findpos(actuelposition,possibleposition[66])){
-                adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);
-                adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);
-                       }
-    }
-
-
-}
\ No newline at end of file
+}

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	2019-05-02 14:40:50 UTC (rev 12337)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	2019-05-03 09:23:15 UTC (rev 12338)
@@ -44,13 +44,9 @@
                 }
             }
 
-        int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
         this->pointInFrontOfPlayer=frontPosition(); //getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
-        //std::cout<<this->pointInFrontOfPlayer<<endl;
-        //std::cout<<this->lastPlayerPassedPoint<<endl;
 
         Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z);
-        //std::cout<<pinkPos<<endl;
         
         //Stop, if target arrived
         if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){
@@ -90,15 +86,8 @@
             while(lockmove){};
             lockmove = true;
 
-            //Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z);
-            //std::cout<<pinkPos<<endl;
-
-            //int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
             //this->pointInFrontOfPlayer=getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
             
-            //std::cout<<this->lastPlayerPassedPoint<<endl;
-
-            //std::cout<<this->pointInFrontOfPlayer<<endl;
             nextMove(pinkPos, pointInFrontOfPlayer, lastPlayerPassedPoint);
 
 
@@ -118,11 +107,13 @@
     
         Vector3 nextTarget;
 
-        std::cout<<this->actuelposition<<endl;
+        /*std::cout<<this->actuelposition<<endl;
         std::cout<<pinkPosP<<endl;
         std::cout<<playerPos<<endl;
         std::cout<<pointToAvoidP11<<endl;
-        std::cout<<this->getPlayerPos()<<endl;
+        std::cout<<this->getPlayerPos()<<endl;*/
+        std::cout<<playerPos<<endl;
+        std::cout<<"kok"<<endl;
 
         if(playerPos==pointToAvoidP11){ //SIGSEV if playerPos==pointToAvoidP11 otherwise
             nextTarget = getShortestPath(pinkPosP, playerPos);
@@ -130,12 +121,22 @@
         /*else if(pinkPosP==pointToAvoidP11){
             nextTarget=getShortestPath(pinkPosP, playerPos);
         }*/
+        else if((playerPos==Vector3(-70,10,-35))/*||(playerPos==Vector3(-20,10,-35))||(playerPos==Vector3(0,10,-35))*/){
+            //nextTarget=pinkPosP;
+        nextTarget=getShortestPath(pinkPosP, Vector3(-70,10,-35));
+        std::cout<<"ChaillyVillage"<<endl;
+        }
+        /*else if((playerPos==Vector3(-70,10,-35))&&(pinkPosP==Vector3(-70,10,60))/*||(playerPos==Vector3(-20,10,-35))||(playerPos==Vector3(0,10,-35))){
+            //nextTarget=pinkPosP;
+        nextTarget=getShortestPath(pinkPosP, Vector3(-70,10,-35));
+        std::cout<<"ChaillyVillage"<<endl;
+        }*/
         else{
             //bugs here
-            std::cout<<"msjiowjqiq"<<endl;
+            std::cout<<pinkPosP<<endl;
         nextTarget = getShortestPath(pinkPosP, playerPos, pointToAvoidP11);
         }
-    
+        std::cout<<nextTarget<<endl;
        setNewTargetGhost(nextTarget);
     }
 

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	2019-05-02 14:40:50 UTC (rev 12337)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	2019-05-03 09:23:15 UTC (rev 12338)
@@ -53,16 +53,6 @@
                 //}
             }
 
-
-        /*if((playerFindPos(this->actuelposition, this->getPlayerPos()))&&(isNearPlayer==false)){
-            isNearPlayer=true;
-            setNewTargetRed(this->getPlayerPos());
-        }
-        else if (!(playerFindPos(this->actuelposition, this->getPlayerPos())&&(isNearPlayer==true))){
-            isNearPlayer=false;
-            setNewTargetRed(this->pointInFrontOfPlayer); 
-        }*/
-
             std::cout<<this->lastPlayerPassedPoint<<endl;
             std::cout<<this->pointInFrontOfPlayer<<endl;
 
@@ -109,7 +99,6 @@
             Vector3 redPos=Vector3(this->target_x, 10, this->target_z);
             //nextMove(this->getPlayerPos(), redPos);
 
-            int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
             this->pointInFrontOfPlayer=frontPosition(); //getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
 
 

Deleted: code/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.cc	2019-05-02 14:40:50 UTC (rev 12337)
+++ code/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.cc	2019-05-03 09:23:15 UTC (rev 12338)
@@ -1,508 +0,0 @@
-    #include "core/CoreIncludes.h"
-    #include "core/XMLPort.h"
-    //#include "getShortestPath.h"
-    #include "PacmanGhost.h"
-
-
-    #include "worldentities/ControllableEntity.h"
-    using namespace std;
-
-    namespace orxonox{
-
-        struct graphVertex {
-
-            Vector3 position;
-            graphVertex *adjacentVertices[4]; //neighbooring vertices
-
-            //would a vector of vector storing the neighboors not be more suitable ?
-
-            int shortestDistanceToStart; //actual shortest distance to start point
-            graphVertex* actuelPredecessor; //the predecessor giving the for now shortest 
-                                            //path to start
-            graphVertex* currentNearestNonVisitedNeighboor; 
-            bool alreadyVisited;
-            graphVertex(){ //default constructor
-                position=0;
-                shortestDistanceToStart= std::numeric_limits<int>::max();
-                actuelPredecessor=NULL;
-                alreadyVisited=false;
-                for(int kl =0; kl <4;kl++){
-                    adjacentVertices[kl]=NULL;  //first put all position in array listing neighboors to 0
-                }
-            }
-            graphVertex(Vector3 wantedPosition){  //normal constructor
-                position=wantedPosition;
-                shortestDistanceToStart= std::numeric_limits<int>::max(); //default distance is infinity
-                actuelPredecessor=NULL;
-                alreadyVisited=false;
-                for(int kl =0; kl <4;kl++){
-                    adjacentVertices[kl]=NULL;  //first put all position in array listing neighboors to 0
-                }
-            }
-            graphVertex* operator = (graphVertex *rightSide){
-            this->position=rightSide->position;
-            this->actuelPredecessor=rightSide->actuelPredecessor;
-            return this;
-        }
-
-        };
-
-        graphVertex listOfVertices[67];
-
-        Vector3 getShortestPath(Vector3 start, Vector3 goal){
-        //this function should then somehow produce the algorithm and call all other functions
-        //and finally return the best neighboor of the actual position of the pacman
-        
-
-        if(start==goal){ // basic case
-            return start;
-        }
-       
-
-        for(int an=0; an < 67; an++){
-      listOfVertices[an]=  graphVertex(possibleposition[an]); //same position order as in other file
-        }
-
-        graphVertex actualVertex= graphVertex(start);
-
-        actualVertex.alreadyVisited=true;
-        actualVertex.shortestDistanceToStart=0;
-        findNeighboorVertices(actualVertex.position, *actualVertex.adjacentVertices); 
-        // second parameter is an array !
-        
-        while(actualVertex.position!=goal){
-            for(int h=0;h < 4; h++){
-                if(actualVertex.adjacentVertices[h]!=NULL){
-                    updateShortestDistanceToStart(actualVertex, *actualVertex.adjacentVertices[h]);
-                } //we "update" the neighboors of our new visited vertex
-            }
-            
-
-            actualVertex=findNextVertexToConsider(listOfVertices);
-            actualVertex.alreadyVisited=true;
-            if(actualVertex.position!=goal){
-                findNeighboorVertices(actualVertex.position,*actualVertex.adjacentVertices); 
-                //we find the neighboors of our new visited vertex
-                }
-        }
-
-        //we should have reached our goal at this point
-
-        while(actualVertex.actuelPredecessor->actuelPredecessor!=NULL){
-            actualVertex=actualVertex.actuelPredecessor;
-        }
-        // the predecessor is our starting point, in other words we are now on an
-        //adjacent vertex of the start
-
-        return actualVertex.position; //we return the position of this adjacent vertex
-    }
-
-    int graphDistance(Vector3 start, Vector3 goal){
-
-        Vector3 differenceVector= Vector3(abs(goal.x-start.x), 0,abs(goal.z-start.z));
-
-        return differenceVector.x+differenceVector.z;
-    }
-
-    void updateShortestDistanceToStart(graphVertex &vertex, graphVertex &neighboor){
-        //apply this method to all non visited neighboors of a vertex.
-        // This method should always be run on a vertex after we marked it as visited.
-        if(neighboor.alreadyVisited==false){ //we only consider non visited neighboors.
-            if(neighboor.shortestDistanceToStart > vertex.shortestDistanceToStart + 
-                graphDistance(vertex.position, neighboor.position)){
-
-                neighboor.shortestDistanceToStart= vertex.shortestDistanceToStart + 
-                graphDistance(vertex.position, neighboor.position);
-                neighboor.actuelPredecessor = &vertex;
-            }
-        }
-
-    }
-
-    void findNearestNonVisitedNeighboor (graphVertex &vertex){ 
-            //find nearest non visited neighboor of a given already visited vertex
-        int shortestDistance = -1;
-        graphVertex nearestNonVisitedNeighboor=graphVertex(); //by default there is not any.
-        //Also, if all neighboors are already visited, we return NULL, i.e. there is no
-        //nearest non visited neighboor.
-        for(int i=0; i < 4; i++){
-            if((vertex.adjacentVertices[i]!=NULL)&&(vertex.adjacentVertices[i]->alreadyVisited==false)){
-                if(shortestDistance==-1){   //(concerns line above) we want a non visited neighboor
-                    shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position);
-                    nearestNonVisitedNeighboor=vertex.adjacentVertices[i];
-                }
-                else if(graphDistance(vertex.position, vertex.adjacentVertices[i]->position)<shortestDistance){
-                    shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position);
-                    nearestNonVisitedNeighboor=vertex.adjacentVertices[i];
-                }
-            }
-        }
-        vertex.currentNearestNonVisitedNeighboor = &nearestNonVisitedNeighboor;
-    }
-
-
-    graphVertex findNextVertexToConsider(graphVertex listOfVerticesP[]){ //find next, nearest from start, non visited vertex 
-
-        int shortestDistance = -1;
-        graphVertex nextVertexToConsider;
-
-        for(int i=0; i < 67; i++){ //we loop over all possible positions 
-
-            if(listOfVerticesP[i].alreadyVisited==true){ //vertex should already be visited 
-
-                findNearestNonVisitedNeighboor(listOfVerticesP[i]); //we update nearest neighboor
-                //of all visited vertices given that one of the nearest neighboor of a visited
-                // vertex is now also visited because it was chosen as next optimal vertex
-
-                if(listOfVerticesP[i].currentNearestNonVisitedNeighboor!=NULL){ //we want a candidate!
-                if(shortestDistance==-1){ //our first possible candidate
-
-            shortestDistance=graphDistance(listOfVerticesP[i].position, 
-            listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 
-            listOfVerticesP[i].shortestDistanceToStart;
-
-            nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor;
-
-                }
-                else if(shortestDistance > graphDistance(listOfVerticesP[i].position, 
-                listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 
-                    listOfVerticesP[i].shortestDistanceToStart){
-
-            shortestDistance=graphDistance(listOfVerticesP[i].position, 
-            listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 
-            listOfVerticesP[i].shortestDistanceToStart;
-
-            nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor;
-                    }
-                }
-            }
-            //we want after all to return the nearest non visited neighboor
-        }
-
-        return nextVertexToConsider;
-    }
-
-    //////////////////////////////////////////////////////////////////////////////////////////////
-
-    //if vertex already visited, call function on it and reapeat until you reach non visited vertex
-    // ---> not sure if a good idea because we risk infinite loop
-
-    //-215 -185 -135 -70 -20 0 20 70 135 185 215 
-
-    //-195 -135 -85 -35 15 60 105 150 195 245
-
-    void findNeighboorVertices(Vector3 actuelposition, graphVertex* adjacentVertices[]){      
-
-
-            if(findpos(actuelposition,possibleposition[0])){
-                // we should use listOfVertices[i] instead of possibleposition[i] I think
-                // so that all neighboors are "the same"
-                adjacentVertices[0]=&listOfVertices[1]; //graphVertex(possibleposition[1]);  //need to do it everywhere !!!
-                adjacentVertices[1]=&listOfVertices[17]; //graphVertex(possibleposition[17]);
-                adjacentVertices[2]=&listOfVertices[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ?
-            }
-            else if(findpos(actuelposition,possibleposition[1])){
-                adjacentVertices[0]=&listOfVertices[0]; //graphVertex(possibleposition[0]);
-                adjacentVertices[1]=&listOfVertices[2]; //graphVertex(possibleposition[2]);
-            }
-            else if(findpos(actuelposition,possibleposition[2])){
-                adjacentVertices[0]=&listOfVertices[1]; //graphVertex(possibleposition[1]);
-                adjacentVertices[1]=&listOfVertices[3]; //graphVertex(possibleposition[3]);
-            }
-            else if(findpos(actuelposition,possibleposition[3])){
-                adjacentVertices[0]=&listOfVertices[2]; //graphVertex(possibleposition[2]);
-                adjacentVertices[1]=&listOfVertices[4]; //graphVertex(possibleposition[4]);
-                adjacentVertices[2]=&listOfVertices[5]; //graphVertex(possibleposition[5]);
-            }
-            else if(findpos(actuelposition,possibleposition[4])){
-                adjacentVertices[0]=&listOfVertices[3]; //graphVertex(possibleposition[3]);
-                adjacentVertices[1]=&listOfVertices[6]; //graphVertex(possibleposition[6]);
-            }
-            else if(findpos(actuelposition,possibleposition[5])){
-                adjacentVertices[0]=&listOfVertices[3]; //graphVertex(possibleposition[3]);
-                adjacentVertices[1]=&listOfVertices[7]; //graphVertex(possibleposition[7]);
-            }
-            else if(findpos(actuelposition,possibleposition[6])){
-                adjacentVertices[0]=&listOfVertices[4]; //graphVertex(possibleposition[4]);
-                adjacentVertices[1]=&listOfVertices[9]; //graphVertex(possibleposition[9]);
-                adjacentVertices[2]=&listOfVertices[26]; //graphVertex(possibleposition[26]);
-            }
-            else if(findpos(actuelposition,possibleposition[7])){
-                adjacentVertices[0]=&listOfVertices[5]; //graphVertex(possibleposition[5]);
-                adjacentVertices[1]=&listOfVertices[8]; //graphVertex(possibleposition[8]);
-            }
-            else if(findpos(actuelposition,possibleposition[8])){
-                adjacentVertices[0]=&listOfVertices[7]; //graphVertex(possibleposition[7]);
-                adjacentVertices[1]=&listOfVertices[9]; //graphVertex(possibleposition[9]);
-            }
-            else if(findpos(actuelposition,possibleposition[9])){
-                adjacentVertices[0]=&listOfVertices[6]; //graphVertex(possibleposition[6]);
-                adjacentVertices[1]=&listOfVertices[8]; //graphVertex(possibleposition[8]);
-                adjacentVertices[2]=&listOfVertices[10]; //graphVertex(possibleposition[10]);
-                adjacentVertices[3]=&listOfVertices[38]; //graphVertex(possibleposition[38]);
-            }
-            else if(findpos(actuelposition,possibleposition[10])){
-                adjacentVertices[0]=&listOfVertices[9]; //graphVertex(possibleposition[9]);
-                adjacentVertices[1]=&listOfVertices[11]; //graphVertex(possibleposition[11]);
-                adjacentVertices[2]=&listOfVertices[45]; //graphVertex(possibleposition[45]);
-            }
-            else if(findpos(actuelposition,possibleposition[11])){
-                adjacentVertices[0]=&listOfVertices[10]; //graphVertex(possibleposition[10]);
-                adjacentVertices[1]=&listOfVertices[12]; //graphVertex(possibleposition[12]);
-                adjacentVertices[2]=&listOfVertices[13]; //graphVertex(possibleposition[13]);
-            }
-            else if(findpos(actuelposition,possibleposition[12])){
-                adjacentVertices[0]=&listOfVertices[11]; //graphVertex(possibleposition[11]);
-                adjacentVertices[1]=&listOfVertices[14]; //graphVertex(possibleposition[14]);
-            }
-            else if(findpos(actuelposition,possibleposition[13])){
-                adjacentVertices[0]=&listOfVertices[11]; //graphVertex(possibleposition[11]);
-                adjacentVertices[1]=&listOfVertices[14]; //graphVertex(possibleposition[14]);
-                adjacentVertices[2]=&listOfVertices[16]; //graphVertex(possibleposition[16]);
-                adjacentVertices[3]=&listOfVertices[61]; //graphVertex(possibleposition[61]);
-            }
-            else if(findpos(actuelposition,possibleposition[14])){
-                adjacentVertices[0]=&listOfVertices[12]; //graphVertex(possibleposition[12]);
-                adjacentVertices[1]=&listOfVertices[13]; //graphVertex(possibleposition[13]);
-                adjacentVertices[2]=&listOfVertices[15]; //graphVertex(possibleposition[15]);
-            }
-            else if(findpos(actuelposition,possibleposition[15])){
-                adjacentVertices[0]=&listOfVertices[14]; //graphVertex(possibleposition[14]);
-                adjacentVertices[1]=&listOfVertices[16]; //graphVertex(possibleposition[16]);
-            }
-            else if(findpos(actuelposition,possibleposition[16])){
-                adjacentVertices[0]=&listOfVertices[13]; //graphVertex(possibleposition[13]);
-                adjacentVertices[1]=&listOfVertices[15]; //graphVertex(possibleposition[15]);
-                adjacentVertices[2]=&listOfVertices[62]; //graphVertex(possibleposition[62]);
-            }
-            else if(findpos(actuelposition,possibleposition[17])){
-                adjacentVertices[0]=&listOfVertices[0]; //graphVertex(possibleposition[0]);
-                adjacentVertices[1]=&listOfVertices[25]; //graphVertex(possibleposition[25]);
-            }
-            else if(findpos(actuelposition,possibleposition[18])){
-                adjacentVertices[0]=&listOfVertices[19]; //graphVertex(possibleposition[19]);
-                adjacentVertices[1]=&listOfVertices[24]; //graphVertex(possibleposition[24]);                
-            }
-            else if(findpos(actuelposition,possibleposition[19])){
-                adjacentVertices[0]=&listOfVertices[0]; //graphVertex(possibleposition[0]);
-                adjacentVertices[1]=&listOfVertices[18]; //graphVertex(possibleposition[18]);
-                adjacentVertices[2]=&listOfVertices[20]; //graphVertex(possibleposition[20]);
-                         }
-            else if(findpos(actuelposition,possibleposition[20])){
-                adjacentVertices[0]=&listOfVertices[19]; //graphVertex(possibleposition[19]);
-                adjacentVertices[1]=&listOfVertices[21]; //graphVertex(possibleposition[21]);
-                       }
-            else if(findpos(actuelposition,possibleposition[21])){
-                adjacentVertices[0]=&listOfVertices[20]; //graphVertex(possibleposition[20]);
-                adjacentVertices[1]=&listOfVertices[22]; //graphVertex(possibleposition[22]);
-                       }
-            else if(findpos(actuelposition,possibleposition[22])){
-                adjacentVertices[0]=&listOfVertices[21]; //graphVertex(possibleposition[21]);
-                adjacentVertices[1]=&listOfVertices[23]; //graphVertex(possibleposition[23]);
-                adjacentVertices[2]=&listOfVertices[31]; //graphVertex(possibleposition[31]);
-                          }
-            else if(findpos(actuelposition,possibleposition[23])){
-                adjacentVertices[0]=&listOfVertices[22]; //graphVertex(possibleposition[22]);
-                adjacentVertices[1]=&listOfVertices[30]; //graphVertex(possibleposition[30]);
-                       }
-            else if(findpos(actuelposition,possibleposition[24])){
-                adjacentVertices[0]=&listOfVertices[18]; //graphVertex(possibleposition[18]);
-                adjacentVertices[1]=&listOfVertices[29]; //graphVertex(possibleposition[29]);
-                       }
-            else if(findpos(actuelposition,possibleposition[25])){
-                adjacentVertices[0]=&listOfVertices[17]; //graphVertex(possibleposition[17]);
-                adjacentVertices[1]=&listOfVertices[26]; //graphVertex(possibleposition[26]);
-                       }
-            else if(findpos(actuelposition,possibleposition[26])){
-                adjacentVertices[0]=&listOfVertices[6]; //graphVertex(possibleposition[6]);
-                adjacentVertices[1]=&listOfVertices[25]; //graphVertex(possibleposition[25]);
-                adjacentVertices[2]=&listOfVertices[27]; //graphVertex(possibleposition[27]);
-                         }
-            else if(findpos(actuelposition,possibleposition[27])){
-                adjacentVertices[0]=&listOfVertices[26]; //graphVertex(possibleposition[26]);
-                adjacentVertices[1]=&listOfVertices[28]; //graphVertex(possibleposition[28]);
-                adjacentVertices[2]=&listOfVertices[37]; //graphVertex(possibleposition[37]);
-                          }
-            else if(findpos(actuelposition,possibleposition[28])){
-                adjacentVertices[0]=&listOfVertices[27]; //graphVertex(possibleposition[27]);
-                adjacentVertices[1]=&listOfVertices[29]; //graphVertex(possibleposition[29]);
-                adjacentVertices[2]=&listOfVertices[36]; //graphVertex(possibleposition[36]);
-                          }
-            else if(findpos(actuelposition,possibleposition[29])){
-                adjacentVertices[0]=&listOfVertices[24]; //graphVertex(possibleposition[24]);
-                adjacentVertices[1]=&listOfVertices[28]; //graphVertex(possibleposition[28]);
-                adjacentVertices[2]=&listOfVertices[30]; //graphVertex(possibleposition[30]);
-                          }
-            else if(findpos(actuelposition,possibleposition[30])){
-                adjacentVertices[0]=&listOfVertices[23]; //graphVertex(possibleposition[23]);
-                adjacentVertices[1]=&listOfVertices[29]; //graphVertex(possibleposition[29]);
-                adjacentVertices[2]=&listOfVertices[34]; //graphVertex(possibleposition[34]);
-                          }
-            else if(findpos(actuelposition,possibleposition[31])){
-                adjacentVertices[0]=&listOfVertices[22]; //graphVertex(possibleposition[22]);
-                adjacentVertices[1]=&listOfVertices[32]; //graphVertex(possibleposition[32]);
-                       }
-            else if(findpos(actuelposition,possibleposition[32])){
-                adjacentVertices[0]=&listOfVertices[31]; //graphVertex(possibleposition[31]);
-                adjacentVertices[1]=&listOfVertices[33]; //graphVertex(possibleposition[33]);
-                       }
-            else if(findpos(actuelposition,possibleposition[33])){
-                adjacentVertices[0]=&listOfVertices[32]; //graphVertex(possibleposition[32]);
-                adjacentVertices[1]=&listOfVertices[34]; //graphVertex(possibleposition[34]);
-                       }
-            else if(findpos(actuelposition,possibleposition[34])){
-                adjacentVertices[0]=&listOfVertices[30]; //graphVertex(possibleposition[30]);
-                adjacentVertices[1]=&listOfVertices[33]; //graphVertex(possibleposition[33]);
-                adjacentVertices[2]=&listOfVertices[35]; //graphVertex(possibleposition[35]);
-                adjacentVertices[3]=&listOfVertices[42]; //graphVertex(possibleposition[42]);
-                
-            }
-            else if(findpos(actuelposition,possibleposition[35])){
-                adjacentVertices[0]=&listOfVertices[34]; //graphVertex(possibleposition[34]);
-                adjacentVertices[1]=&listOfVertices[36]; //graphVertex(possibleposition[36]);
-                adjacentVertices[2]=&listOfVertices[41]; //graphVertex(possibleposition[41]);
-                          }
-            else if(findpos(actuelposition,possibleposition[36])){
-                adjacentVertices[0]=&listOfVertices[28]; //graphVertex(possibleposition[28]);
-                adjacentVertices[1]=&listOfVertices[35]; //graphVertex(possibleposition[35]);
-                       }
-            else if(findpos(actuelposition,possibleposition[37])){
-                adjacentVertices[0]=&listOfVertices[27]; //graphVertex(possibleposition[27]);
-                adjacentVertices[1]=&listOfVertices[38]; //graphVertex(possibleposition[38]);
-                       }
-            else if(findpos(actuelposition,possibleposition[38])){
-                adjacentVertices[0]=&listOfVertices[9]; //graphVertex(possibleposition[9]);
-                adjacentVertices[1]=&listOfVertices[37]; //graphVertex(possibleposition[37]);
-                adjacentVertices[2]=&listOfVertices[39]; //graphVertex(possibleposition[39]);
-                         }
-            else if(findpos(actuelposition,possibleposition[39])){
-                adjacentVertices[0]=&listOfVertices[38]; //graphVertex(possibleposition[38]);
-                adjacentVertices[1]=&listOfVertices[40]; //graphVertex(possibleposition[40]);
-                adjacentVertices[2]=&listOfVertices[45]; //graphVertex(possibleposition[45]);
-                          }
-            else if(findpos(actuelposition,possibleposition[40])){
-                adjacentVertices[0]=&listOfVertices[39]; //graphVertex(possibleposition[39]);
-                adjacentVertices[1]=&listOfVertices[41]; //graphVertex(possibleposition[41]);
-            }
-            else if(findpos(actuelposition,possibleposition[41])){
-                adjacentVertices[0]=&listOfVertices[35]; //graphVertex(possibleposition[35]);
-                adjacentVertices[1]=&listOfVertices[43]; //graphVertex(possibleposition[43]);
-                       }
-            else if(findpos(actuelposition,possibleposition[42])){
-                adjacentVertices[0]=&listOfVertices[34]; //graphVertex(possibleposition[34]);
-                adjacentVertices[1]=&listOfVertices[43]; //graphVertex(possibleposition[43]);
-                adjacentVertices[2]=&listOfVertices[54]; //graphVertex(possibleposition[54]);
-                          }
-            else if(findpos(actuelposition,possibleposition[43])){
-                adjacentVertices[0]=&listOfVertices[41]; //graphVertex(possibleposition[41]);
-                adjacentVertices[1]=&listOfVertices[46]; //graphVertex(possibleposition[46]);
-                       }
-            else if(findpos(actuelposition,possibleposition[44])){
-                adjacentVertices[0]=&listOfVertices[40]; //graphVertex(possibleposition[40]);
-                adjacentVertices[1]=&listOfVertices[66]; //graphVertex(possibleposition[66]);
-                       }
-            else if(findpos(actuelposition,possibleposition[45])){
-                adjacentVertices[0]=&listOfVertices[10]; //graphVertex(possibleposition[10]);
-                adjacentVertices[1]=&listOfVertices[39]; //graphVertex(possibleposition[39]);
-                adjacentVertices[2]=&listOfVertices[49]; //graphVertex(possibleposition[49]);
-                          }
-            else if(findpos(actuelposition,possibleposition[46])){
-                adjacentVertices[0]=&listOfVertices[43]; //graphVertex(possibleposition[43]);
-                adjacentVertices[1]=&listOfVertices[47]; //graphVertex(possibleposition[47]);
-                       }
-            else if(findpos(actuelposition,possibleposition[47])){
-                adjacentVertices[0]=&listOfVertices[46]; //graphVertex(possibleposition[46]);
-                adjacentVertices[1]=&listOfVertices[52]; //graphVertex(possibleposition[52]);
-                adjacentVertices[2]=&listOfVertices[66]; //graphVertex(possibleposition[66]);
-                          }
-            else if(findpos(actuelposition,possibleposition[48])){
-                adjacentVertices[0]=&listOfVertices[49]; //graphVertex(possibleposition[49]);
-                adjacentVertices[1]=&listOfVertices[51]; //graphVertex(possibleposition[51]);
-                adjacentVertices[2]=&listOfVertices[66]; //graphVertex(possibleposition[66]);
-                          }
-            else if(findpos(actuelposition,possibleposition[49])){
-                adjacentVertices[0]=&listOfVertices[45]; //graphVertex(possibleposition[45]);
-                adjacentVertices[1]=&listOfVertices[48]; //graphVertex(possibleposition[48]);
-                       }
-            else if(findpos(actuelposition,possibleposition[50])){
-                adjacentVertices[0]=&listOfVertices[51]; //graphVertex(possibleposition[51]);
-                adjacentVertices[1]=&listOfVertices[61]; //graphVertex(possibleposition[61]);
-                       }
-            else if(findpos(actuelposition,possibleposition[51])){
-                adjacentVertices[0]=&listOfVertices[48]; //graphVertex(possibleposition[48]);
-                adjacentVertices[1]=&listOfVertices[50]; //graphVertex(possibleposition[50]);
-                       }
-            else if(findpos(actuelposition,possibleposition[52])){
-                adjacentVertices[0]=&listOfVertices[47]; //graphVertex(possibleposition[47]);
-                adjacentVertices[1]=&listOfVertices[53]; //graphVertex(possibleposition[53]);
-                       }
-            else if(findpos(actuelposition,possibleposition[53])){
-                adjacentVertices[0]=&listOfVertices[52]; //graphVertex(possibleposition[52]);
-                adjacentVertices[1]=&listOfVertices[58]; //graphVertex(possibleposition[58]);
-                       }
-            else if(findpos(actuelposition,possibleposition[54])){
-                adjacentVertices[0]=&listOfVertices[42]; //graphVertex(possibleposition[42]);
-                adjacentVertices[1]=&listOfVertices[55]; //graphVertex(possibleposition[55]);
-                adjacentVertices[2]=&listOfVertices[57]; //graphVertex(possibleposition[57]);
-                          }
-            else if(findpos(actuelposition,possibleposition[55])){
-                adjacentVertices[0]=&listOfVertices[54]; //graphVertex(possibleposition[54]);
-                adjacentVertices[1]=&listOfVertices[56]; //graphVertex(possibleposition[56]);
-                       }
-            else if(findpos(actuelposition,possibleposition[56])){
-                adjacentVertices[0]=&listOfVertices[55]; //graphVertex(possibleposition[55]);
-                adjacentVertices[1]=&listOfVertices[57]; //graphVertex(possibleposition[57]);
-                adjacentVertices[2]=&listOfVertices[65]; //graphVertex(possibleposition[65]);
-                          }
-            else if(findpos(actuelposition,possibleposition[57])){
-                adjacentVertices[0]=&listOfVertices[54]; //graphVertex(possibleposition[54]);
-                adjacentVertices[1]=&listOfVertices[56]; //graphVertex(possibleposition[56]);
-                adjacentVertices[2]=&listOfVertices[58]; //graphVertex(possibleposition[58]);
-                adjacentVertices[3]=&listOfVertices[64]; //graphVertex(possibleposition[64]);
-                
-            }
-            else if(findpos(actuelposition,possibleposition[58])){
-                adjacentVertices[0]=&listOfVertices[53]; //graphVertex(possibleposition[53]);
-                adjacentVertices[1]=&listOfVertices[57]; //graphVertex(possibleposition[57]);
-                adjacentVertices[2]=&listOfVertices[59]; //graphVertex(possibleposition[59]);
-                          }
-            else if(findpos(actuelposition,possibleposition[59])){
-                adjacentVertices[0]=&listOfVertices[58]; //graphVertex(possibleposition[58]);
-                adjacentVertices[1]=&listOfVertices[59]; //graphVertex(possibleposition[59]);
-                adjacentVertices[2]=&listOfVertices[63]; //graphVertex(possibleposition[63]);
-                          }
-            else if(findpos(actuelposition,possibleposition[60])){
-                adjacentVertices[0]=&listOfVertices[59]; //graphVertex(possibleposition[59]);
-                adjacentVertices[1]=&listOfVertices[61]; //graphVertex(possibleposition[61]);
-                adjacentVertices[2]=&listOfVertices[62]; //graphVertex(possibleposition[62]);
-                          }
-            else if(findpos(actuelposition,possibleposition[61])){
-                adjacentVertices[0]=&listOfVertices[13]; //graphVertex(possibleposition[13]);
-                adjacentVertices[1]=&listOfVertices[50]; //graphVertex(possibleposition[50]);
-                adjacentVertices[2]=&listOfVertices[60]; //graphVertex(possibleposition[60]);
-                          }
-            else if(findpos(actuelposition,possibleposition[62])){
-                adjacentVertices[0]=&listOfVertices[16]; //graphVertex(possibleposition[16]);
-                adjacentVertices[1]=&listOfVertices[60]; //graphVertex(possibleposition[60]);
-                       }
-            else if(findpos(actuelposition,possibleposition[63])){
-                adjacentVertices[0]=&listOfVertices[59]; //graphVertex(possibleposition[59]);
-                adjacentVertices[1]=&listOfVertices[64]; //graphVertex(possibleposition[64]);
-                       }
-            else if(findpos(actuelposition,possibleposition[64])){
-                adjacentVertices[0]=&listOfVertices[57]; //graphVertex(possibleposition[57]);
-                adjacentVertices[1]=&listOfVertices[63]; //graphVertex(possibleposition[63]);
-                adjacentVertices[2]=&listOfVertices[65]; //graphVertex(possibleposition[65]);
-                          }
-            else if(findpos(actuelposition,possibleposition[65])){
-                adjacentVertices[0]=&listOfVertices[56]; //graphVertex(possibleposition[56]);
-                adjacentVertices[1]=&listOfVertices[64]; //graphVertex(possibleposition[64]);
-                       }
-            else if(findpos(actuelposition,possibleposition[66])){
-                adjacentVertices[0]=&listOfVertices[47]; //graphVertex(possibleposition[47]);
-                adjacentVertices[1]=&listOfVertices[48]; //graphVertex(possibleposition[48]);
-                       }
-    }
-
-
-}



More information about the Orxonox-commit mailing list