Index: /code/branches/3DPacman_FS19/src/modules/pacman/CMakeLists.txt
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/CMakeLists.txt	(revision 12303)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/CMakeLists.txt	(revision 12304)
@@ -6,6 +6,7 @@
   PacmanPointAfraid.cc
   PacmanHUDinfo.cc
+  PacmanRandom.cc
+  PacmanRed.cc
   getShortestPath.cc
-  PacmanRandom.cc
 )
 
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	(revision 12304)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	(revision 12304)
@@ -0,0 +1,211 @@
+	
+#include "PacmanBrown.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+	
+	namespace orxonox{
+
+		RegisterClass(PacmanBrown);
+
+		PacmanBrown::PacmanBrown(Context* context) : PacmanGhost(context){
+
+        RegisterObject(PacmanBrown);
+          
+    }
+
+    /**
+    @brief
+        Method for creating a ghost through XML.
+    */
+    void PacmanBrown::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(PacmanBrown, XMLPort, xmlelement, mode);
+    }
+
+
+
+	void PacmanBrown::tick(float dt)
+    {
+        SUPER(PacmanGhost, tick, dt);
+
+        this->actuelposition = this->getPosition();
+        
+        //Stop, if target arrived
+        if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){
+                 this->ismoving = false;
+        }
+
+        //Move, if ghost hasn't arrived yet
+        if(this->ismoving){
+            if(!(abs(this->actuelposition.z-target_z)<0.5)) {
+                velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
+                move(dt, actuelposition, velocity);
+            }    
+            if(!(abs(this->actuelposition.x-target_x)<0.5)){
+                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
+                move(dt, actuelposition, velocity);
+            }
+        }
+        
+        //Check on which position the ghost has arrived and set new target
+        else{
+
+        	while(lockmove){};
+            lockmove = true;
+
+        	//do brown behavior
+        	//put everything needed here
+
+        	if((this->fleeing==true)&&(this->actuelposition!=(-215,10,-195))){
+            //if fleeing, then go to corner map if not already there
+        		fleeMode();
+        	}
+        	else{ // else go next to pacman
+
+        		if(absoluteDistance(this->pos, player.pos)<10){//no idea if 10 ok
+        	//if near player, flee away
+        	fleemode();
+        			}
+        		else{ //go to neighboor of player nearest to brown pacman
+
+        		//first find nearest neighboor point of player to brown pacman
+        		//we can maybe call getShortestPath recursively to do so
+
+player.pos.nearestneighboor=findPlayerNeighboorNearestToPacman(player.neighboors);
+//btw the array player.neighboor can be defined with a big list as we
+//already did several times for similar things
+
+        	Vector3 nextMove = getShortestPath(this->actuelposition, player.pos.nearestneighboor);
+        	setNewTargetBrown(nextMove);
+        		}
+
+        	}
+   
+        }
+        
+    }
+
+
+
+
+
+
+
+
+
+
+	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 setNewTargetBrown(Vector3 goalToGo){
+
+					this->target_x = goalToGo.x;
+                    this->target_z = goalToGo.z; 
+                    this->ismoving = true;
+	}
+
+
+
+	int absoluteDistance(Vector3 pos1, Vector3 pos2){
+
+
+		Vector3 diffVector;
+		diffVector.x=pos2-pos1;
+		diffVector.y=pos2-pos1; //should always be 0
+		diffVector.z=pos2-pos1;
+		int result = sqrt(diffVector.x²+diffVector.z²);
+		return result;
+	}
+
+
+	void fleeMode(){ //flees to corner of the map
+
+		Vector3 cornerPos = Vector3(-215,10,-195); //let's take this. We can still change
+		Vector3 nextMove = getShortestPath(this->actuelposition, cornerPos);
+		setNewTargetBrown(nextMove);
+
+		/*//while(this->actuelposition!=cornerPos){
+	
+		continue moving and each time find next point to go until
+		we reach the corner
+		}*/
+	}
+
+
+	Vector3 goAdjacentOfPlayer(Vector neighboorsOfPlayer[]){
+		//find ,nearest to brown, player neighboor 
+
+		int besTotDist=-1;
+		Vector3 curPos=this->pos;
+		Vector3  predPos;
+		Vector3 chosenNeighbor;
+
+		for(int i=0; i < 4; i++){
+			int totDist=0;
+
+			if(neighboorsOfPlayer[i]!=0){
+				while(curPos!=neighboorsOfPlayer[i]){
+
+					predPos=curPos;
+					curPos = getShortestPath(curPos, neighboorsOfPlayer[i]);
+					totDist+=graphDistance(curPos,predPos);
+
+				}
+			}
+
+			if(besTotDist==-1){
+				besTotDist=totDist;
+				chosenNeighbor=neighboorsOfPlayer[i];
+			}
+			else if(besTotDist>totDist){
+				besTotDist=totDist;
+				chosenNeighbor=neighboorsOfPlayer[i];
+			}
+		}
+		return chosenNeighbor;
+
+	}
+
+
+	Vector3 findPlayerNeighboorNearestToPacman(Vector3 neighboorArray[]){
+		//uh, i think it does the same think as the function above
+
+        Vector3 nextMove;
+        int distCost=-1;
+        for(int i=0; i < 4; i++){
+        	int totDist=0;
+        	Vector3 newCandidate=this->actuelposition;
+        	Vector3 predPos;
+
+            if(neighboorArray[i]!=NULL){
+                while(nextMove!=neighboorArray[i]){
+                	predPos=newCandidate;
+                	newCandidate=getShortestPath(newCandidate, neighboorArray[i]);
+                	totDist+=graphDistance(predPos, newCandidate);
+                    }
+
+                    if(distCost==-1){
+                distCost=totDist;
+                nextMove=gneighboorArray[i];
+                    }
+                    else if(totDist<distCost){
+                distCost=totDist;
+                nextMove=neighboorArray[i];
+                    }
+            }
+        }
+        return nextMove;
+
+    }
+
+}
+
+
+
+
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.h
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.h	(revision 12304)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.h	(revision 12304)
@@ -0,0 +1,40 @@
+#ifndef _PacmanBrown_H__
+#define _PacmanBrown_H__
+
+
+#include "PacmanGhost.h"
+//#include "getShortestPath.h"
+
+
+namespace orxonox {
+
+	class _OrxonoxExport PacmanBrown : public PacmanGhost{
+
+		public :
+			PacmanBrown(Context* context);
+
+			virtual void tick(float dt) override; //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+  			virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+  			void setNewTargetBrown(Vector3 goalToGo);
+
+  			void nextMove(Vector3 playerPos, Vector3 redPos);
+
+  			int graphDistance(Vector3 start, Vector3 goal);
+
+  			int absoluteDistance(Vector3 pos1, Vector3 pos2);
+
+  			void fleeMode();
+
+
+  			Vector3 goAdjacentOfPlayer(Vector neighboorsOfPlayer[]);
+  			//they both do the same -_-
+  			Vector3 findPlayerNeighboorNearestToPacman(Vector3 neighboorArray);
+
+
+	};
+
+}
+
+#endif 
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	(revision 12303)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	(revision 12304)
@@ -34,4 +34,27 @@
 namespace orxonox
 {
+
+    //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;
+        }
+
+    //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
+
     RegisterClass(PacmanGhost);
 
@@ -47,4 +70,5 @@
 
         this->velocity = Vector3(0, 0, 0);
+
         this->setCollisionType(CollisionType::Dynamic);
         
@@ -72,70 +96,7 @@
         Method for creating a ghost through XML.
     */
-    void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+     void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
         SUPER(PacmanGhost, XMLPort, xmlelement, mode);
-
-    }
-
-
-   /* //All positions in the map, see documentation
-    Vector3 possibleposition[] = {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
-        Defines which actions the ghost has to take in each tick.
-    @param dt
-        The length of the tick.
-    */
-    void PacmanGhost::tick(float dt)
-    {
-        SUPER(PacmanGhost, tick, dt);
-
-        this->actuelposition = this->getPosition();
-        
-        //Stop, if target arrived
-        if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){
-                 this->ismoving = false;
-        }
-
-        //Move, if ghost hasn't arrived yet
-        if(this->ismoving){
-            if(!(abs(this->actuelposition.z-target_z)<0.5)) {
-                velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
-                move(dt, actuelposition, velocity);
-            }    
-            if(!(abs(this->actuelposition.x-target_x)<0.5)){
-                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
-                move(dt, actuelposition, velocity);
-            }
-        }
-
-    }
-
-
-    //Random choice of new target (not used in game, but useful)
-    void PacmanGhost::setnewTarget(int firstdec){
-        
-    	  decision = rand()%1;
-            switch(decision){
-                case 0:
-                    this->target_x = possibleposition[firstdec].x;
-                    this->target_z = possibleposition[firstdec].z; 
-                    this->ismoving = true;
-                    break;
-    		}
     }
 
@@ -164,5 +125,5 @@
         
         //Rotate ghost in the direction of movement 
-        if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1))
+        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)));  
@@ -171,5 +132,6 @@
                  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((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)));  
@@ -178,12 +140,7 @@
                  this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0)));  
             }
+        }
                      
      }
-    }
-
-    //Check if there is a collision
-    bool PacmanGhost::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;
     }
 
@@ -213,3 +170,16 @@
         speed ++;
     }
+
+    Vector3 PacmanGhost::setPureArrayPos(Vector3 &posToSet){
+        //given that the position of a pacman is generally not "neat",
+        //we need to set it to the nearest point on the map
+        // if the pacman is not moving anymore, i.e. has reached a point
+        int i=0;
+        while(!(findpos(possibleposition[i], posToSet))){
+            i++;
+        }
+        return possibleposition[i];
+    }
+
+
 }
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h	(revision 12303)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h	(revision 12304)
@@ -38,4 +38,17 @@
 namespace orxonox {
 
+    extern Vector3 possibleposition[67];
+
+    extern bool findpos(Vector3 one, Vector3 other);
+
+
+    struct graphVertex;
+    void findNeighboorVertices(Vector3 actuelposition, graphVertex adjacentVertices[]);
+    void updateShortestDistanceToStart(graphVertex &vertex, graphVertex &neighboor);
+    graphVertex findNextVertexToConsider(graphVertex[]);
+
+    extern graphVertex listOfVertices[];
+
+
     class _OrxonoxExport PacmanGhost : public ControllableEntity
     {
@@ -44,19 +57,19 @@
             virtual ~PacmanGhost();
 
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
-            virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating an AutonomousDrone through XML.
+            //virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
 
-            void move(float dt, Vector3 actuelposition, Vector3 velocity);
+            virtual void move(float dt, Vector3 actuelposition, Vector3 velocity);
             
-            void resetGhost();
+            virtual void resetGhost();
 
-            void changewith(PacmanGhost* otherghost);
-            void levelupvelo();
+            virtual void changewith(PacmanGhost* otherghost);
+            virtual void levelupvelo();
 
-            bool findpos(Vector3 one, Vector3 other);      
-            void changemovability();
+            //bool findpos(Vector3 one, Vector3 other);      
+            virtual void changemovability();
             bool dontmove = false;
 
-
+       
             int decision = 0; 
             Vector3 resetposition = Vector3(0,10,15);
@@ -70,25 +83,9 @@
             bool lockmove = false;
 
-            //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
+        Vector3 getShortestPath(Vector3 start, Vector3 goal);
 
-        private:
-            void setnewTarget(int firstdec);
-            void setnewTarget(int firstdec, int seconddec);
-            void setnewTarget(int firstdec, int seconddec, int thirddec);
-            void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec);
+        Vector3 setPureArrayPos(Vector3 &posToSet);
+
+            private:
     };
 
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	(revision 12304)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	(revision 12304)
@@ -0,0 +1,555 @@
+	
+#include "PacmanPink.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+	
+namespace orxonox{
+
+	RegisterClass(PacmanPink);
+
+		PacmanPink::PacmanPink(Context* context) : PacmanGhost(context){
+
+        RegisterObject(PacmanPink);
+          
+    }
+
+    /**
+    @brief
+        Method for creating a ghost through XML.
+    */
+    void PacmanPink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(PacmanPink, XMLPort, xmlelement, mode);
+    }
+
+
+    void PacmanPink::tick(float dt)
+    {
+        SUPER(PacmanGhost, tick, dt);
+
+        this->actuelposition = this->getPosition();
+        
+        //Stop, if target arrived
+        if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){
+                 this->ismoving = false;
+        }
+
+        //Move, if ghost hasn't arrived yet
+        if(this->ismoving){
+            if(!(abs(this->actuelposition.z-target_z)<0.5)) {
+                velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
+                move(dt, actuelposition, velocity);
+            }    
+            if(!(abs(this->actuelposition.x-target_x)<0.5)){
+                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
+                move(dt, actuelposition, velocity);
+            }
+        }
+        //Check on which position the ghost has arrived and set new target
+         else{
+            while(lockmove){};
+            lockmove = true;
+
+            if(findPos(player.getPos(), player.lastPassedPoint)){
+            	// if player is on a point, for simplicity go to it
+            Vector3 nextMove = getShortestPath(this->actuelposition, player.lastPassedPoint);
+            setNewTargetPink(nextMove);
+            }
+
+            else{ //if player is not on a point either go to next neighboor, or if no 
+            //neighboor in player direction available, go to last point passed by player.
+
+            int dir=findPlayerTravDir(player.lastPassedPoint, player.getPos());
+            //not in other sense!
+
+            Vector3[] neighboors;
+            findNeighboor(player.lastPassedPoint, neighboors);
+            //we need to create function that finds neighboors of player last point
+            //We can use and even should use the part of the tick random function
+            // that determines the neighboors. But array neighboor should be in form
+            // south-west-north-east respectively to array index.
+
+            for(int s=0; s < 4; s++){
+            	//find next neighboor between player and player.lastPassedPoint
+            	if((neighboors[s]!=NULL)&&(s==dir)){
+            		if(dir==0){
+            			Vector3 nextMove=getShortestPath(this->actuelposition, neighboors[s]);
+            			setNewTargetPink(nextMove);
+            		}
+            		else if(dir==1){
+            			Vector3 nextMove=getShortestPath(this->actuelposition, neighboors[s]);
+            			setNewTargetPink(nextMove);
+            		}
+            		else if(dir==2){
+            			Vector3 nextMove=getShortestPath(this->actuelposition, neighboors[s]);
+            			setNewTargetPink(nextMove);
+            		}
+            		else{//last is default
+            			Vector3 nextMove=getShortestPath(this->actuelposition, neighboors[s]);
+            			setNewTargetPink(nextMove);
+            				}
+            		}
+            	else{//if no further point after last player point possible
+            		//then simply go to this last point.
+            	Vector3 nextMove=getShortestPath(this->actuelposition, player.lastPassedPoint);
+            		setNewTargetPink(nextMove);
+            		}
+
+            	}
+
+            }
+
+        }
+
+
+
+	
+	Vector3 diffVector (Vector3 start, Vector3 goal){
+
+		Vector3 result;
+		result.x=goal.x-start.x;
+		result.z=goal.z-start.z;
+		return result;
+	}
+
+	int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos){
+		//return 0 for south, 1 for west, 2 for north, 3 for east
+
+		Vector3 difference = diffVector(playerPosBefore, playerPos);
+
+
+		if((difference.z < 0)&&(difference.z>difference.x)){ //move south
+
+			return 0;
+		}
+		else if((difference.x < 0)&&(difference.x > difference.z )){//move west
+
+			return 1;
+		}
+
+		else if((difference.z>0)&&(difference.z>difference.x)){ //mouve north
+
+			return 2;
+		}
+
+		else if((difference.x>0)&&(difference.x>difference.z)){ //move east
+			return 3;
+
+		}
+
+		else { //default move west 
+
+		return 1;
+		}
+		
+
+	Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE){
+		//return the Vector3 point that Pinky should target to
+		//be in front of pacman
+
+		Vector3 listOfNeighboors[4];
+		//first element is south, 2nd west, 3d north, 4th east
+
+		/*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*/
+
+
+
+
+        	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[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[1])){
+                listOfNeighboors[1]=possibleposition[0]; // west neighbor
+        		listOfNeighboors[2]=possibleposition[2]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[2])){
+            	listOfNeighboors[0]=possibleposition[1];  //south
+                listOfNeighboors[1]=possibleposition[3]; //west
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[3])){
+                listOfNeighboors[1]=possibleposition[4]; //west
+        		listOfNeighboors[2]=possibleposition[5]; //north
+        		listOfNeighboors[3]=possibleposition[2]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[4])){
+        		listOfNeighboors[2]=possibleposition[6]; //north
+        		listOfNeighboors[3]=possibleposition[3]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[5])){
+                listOfNeighboors[0]=possibleposition[3]; //south
+        		listOfNeighboors[3]=possibleposition[7]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[6])){
+                listOfNeighboors[0]=possibleposition[4]; //south
+                listOfNeighboors[1]=possibleposition[26]; //west
+        		listOfNeighboors[2]=possibleposition[9]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[7])){
+                listOfNeighboors[1]=possibleposition[5]; //west
+        		listOfNeighboors[2]=possibleposition[8]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[8])){
+                listOfNeighboors[0]=possibleposition[7]; //south
+                listOfNeighboors[1]=possibleposition[9]; //west
+        		return listOfNeighboors[s];
+            }
+            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[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[10])){
+                listOfNeighboors[0]=possibleposition[9]; //south
+                listOfNeighboors[1]=possibleposition[45]; //west
+        		listOfNeighboors[2]=possibleposition[11]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[11])){
+                listOfNeighboors[0]=possibleposition[10]; //south
+        		listOfNeighboors[2]=possibleposition[13]; //north
+        		listOfNeighboors[3]=possibleposition[12]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[12])){
+                listOfNeighboors[1]=possibleposition[11]; //west
+        		listOfNeighboors[2]=possibleposition[14]; //north
+        		return listOfNeighboors[s];
+            }
+            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[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[14])){
+                listOfNeighboors[0]=possibleposition[12]; //south
+                listOfNeighboors[1]=possibleposition[13]; //west
+        		listOfNeighboors[2]=possibleposition[15]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[15])){
+                listOfNeighboors[0]=possibleposition[14]; //south
+                listOfNeighboors[1]=possibleposition[16]; //west
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[16])){
+                listOfNeighboors[0]=possibleposition[13]; //south
+                listOfNeighboors[1]=possibleposition[62]; //west
+        		listOfNeighboors[2]=possibleposition[15]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[17])){
+                listOfNeighboors[0]=possibleposition[0]; //south
+        		listOfNeighboors[3]=possibleposition[25]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[18])){
+                listOfNeighboors[0]=possibleposition[19]; //south
+                listOfNeighboors[1]=possibleposition[24]; //west
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[19])){
+                listOfNeighboors[1]=possibleposition[20]; //west
+        		listOfNeighboors[2]=possibleposition[18]; //north
+        		listOfNeighboors[3]=possibleposition[0]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[20])){
+        		listOfNeighboors[2]=possibleposition[21]; //north
+        		listOfNeighboors[3]=possibleposition[19]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[21])){
+                listOfNeighboors[0]=possibleposition[20]; //south
+        		listOfNeighboors[3]=possibleposition[22]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[22])){
+                listOfNeighboors[1]=possibleposition[21]; //west
+        		listOfNeighboors[2]=possibleposition[31]; //north
+        		listOfNeighboors[3]=possibleposition[23]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[23])){
+                listOfNeighboors[1]=possibleposition[22]; //west
+        		listOfNeighboors[2]=possibleposition[30]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[24])){
+        		listOfNeighboors[2]=possibleposition[29]; //north
+        		listOfNeighboors[3]=possibleposition[18]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[25])){
+                listOfNeighboors[1]=possibleposition[17]; //west
+        		listOfNeighboors[2]=possibleposition[26]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[26])){
+                listOfNeighboors[0]=possibleposition[25]; //south
+                listOfNeighboors[1]=possibleposition[27]; //west
+        		listOfNeighboors[3]=possibleposition[6]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[27])){
+                listOfNeighboors[1]=possibleposition[28]; //west
+        		listOfNeighboors[2]=possibleposition[37]; //north
+        		listOfNeighboors[3]=possibleposition[26]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[28])){
+                listOfNeighboors[1]=possibleposition[29]; //west
+        		listOfNeighboors[2]=possibleposition[36]; //north
+        		listOfNeighboors[3]=possibleposition[27]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[29])){
+                listOfNeighboors[0]=possibleposition[24]; //south
+                listOfNeighboors[1]=possibleposition[30]; //west
+        		listOfNeighboors[3]=possibleposition[28]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[30])){
+                listOfNeighboors[0]=possibleposition[23]; //south
+        		listOfNeighboors[2]=possibleposition[34]; //north
+        		listOfNeighboors[3]=possibleposition[29]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[31])){
+                listOfNeighboors[0]=possibleposition[22]; //south
+                listOfNeighboors[1]=possibleposition[32]; //west
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[32])){
+        		listOfNeighboors[2]=possibleposition[33]; //north
+        		listOfNeighboors[3]=possibleposition[31]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[33])){
+                listOfNeighboors[0]=possibleposition[32]; //south
+        		listOfNeighboors[3]=possibleposition[34]; //east
+        		return listOfNeighboors[s];
+            }
+            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[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[35])){
+                listOfNeighboors[1]=possibleposition[34]; //west
+        		listOfNeighboors[2]=possibleposition[91]; //north
+        		listOfNeighboors[3]=possibleposition[36]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[36])){
+                listOfNeighboors[0]=possibleposition[28]; //south
+                listOfNeighboors[1]=possibleposition[35]; //west
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[37])){
+                listOfNeighboors[0]=possibleposition[27]; //south
+        		listOfNeighboors[3]=possibleposition[38]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[38])){
+                listOfNeighboors[1]=possibleposition[37]; //west
+        		listOfNeighboors[2]=possibleposition[39]; //north
+        		listOfNeighboors[3]=possibleposition[9]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[39])){
+                listOfNeighboors[0]=possibleposition[38]; //south
+                listOfNeighboors[1]=possibleposition[40]; //west
+        		listOfNeighboors[2]=possibleposition[45]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[40])){
+                listOfNeighboors[1]=possibleposition[41]; //west
+        		//Not return in center
+        		listOfNeighboors[3]=possibleposition[39]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[41])){
+                listOfNeighboors[0]=possibleposition[35]; //south
+        		listOfNeighboors[2]=possibleposition[43]; //north
+        		listOfNeighboors[3]=possibleposition[40]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[42])){
+                listOfNeighboors[0]=possibleposition[39]; //south
+        		listOfNeighboors[2]=possibleposition[59]; //north
+        		listOfNeighboors[3]=possibleposition[43]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[43])){
+                listOfNeighboors[0]=possibleposition[41]; //south
+                listOfNeighboors[1]=possibleposition[42]; //west
+        		listOfNeighboors[2]=possibleposition[46]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[44])){
+                listOfNeighboors[0]=possibleposition[40]; //south
+        		listOfNeighboors[2]=possibleposition[66]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[45])){
+                listOfNeighboors[0]=possibleposition[39]; //south
+        		listOfNeighboors[2]=possibleposition[49]; //north
+        		listOfNeighboors[3]=possibleposition[10]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[46])){
+                listOfNeighboors[0]=possibleposition[43]; //south
+        		listOfNeighboors[3]=possibleposition[47]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[47])){
+                listOfNeighboors[1]=possibleposition[46]; //west
+        		listOfNeighboors[2]=possibleposition[52]; //north
+        		listOfNeighboors[3]=possibleposition[66]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[48])){
+                listOfNeighboors[1]=possibleposition[66]; //west
+        		listOfNeighboors[2]=possibleposition[51]; //north
+        		listOfNeighboors[3]=possibleposition[49]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[49])){
+                listOfNeighboors[0]=possibleposition[45]; //south
+                listOfNeighboors[1]=possibleposition[48]; //west
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[50])){
+                listOfNeighboors[1]=possibleposition[51]; //west
+        		listOfNeighboors[2]=possibleposition[61]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[51])){
+                listOfNeighboors[0]=possibleposition[48]; //south
+        		listOfNeighboors[3]=possibleposition[50]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[52])){
+                listOfNeighboors[0]=possibleposition[47]; //south
+                listOfNeighboors[1]=possibleposition[53]; //west
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[53])){
+        		listOfNeighboors[2]=possibleposition[58]; //north
+        		listOfNeighboors[3]=possibleposition[52]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[54])){
+                listOfNeighboors[0]=possibleposition[42]; //south
+                listOfNeighboors[1]=possibleposition[55]; //west
+        		listOfNeighboors[2]=possibleposition[57]; //north
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[55])){
+        		listOfNeighboors[2]=possibleposition[56]; //north
+        		listOfNeighboors[3]=possibleposition[54]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[56])){
+                listOfNeighboors[0]=possibleposition[55]; //south
+        		listOfNeighboors[2]=possibleposition[65]; //north
+        		listOfNeighboors[3]=possibleposition[57]; //east
+        		return listOfNeighboors[s];
+            }
+            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[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[58])){
+                listOfNeighboors[0]=possibleposition[53]; //south
+                listOfNeighboors[1]=possibleposition[57]; //west
+        		listOfNeighboors[3]=possibleposition[59]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[59])){
+                listOfNeighboors[1]=possibleposition[58]; //west
+        		listOfNeighboors[2]=possibleposition[63]; //north
+        		listOfNeighboors[3]=possibleposition[60]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[60])){
+                listOfNeighboors[1]=possibleposition[59]; //west
+        		listOfNeighboors[2]=possibleposition[62]; //north
+        		listOfNeighboors[3]=possibleposition[61]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[61])){
+                listOfNeighboors[0]=possibleposition[50]; //south
+                listOfNeighboors[1]=possibleposition[60]; //west
+        		listOfNeighboors[3]=possibleposition[13]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[62])){
+                listOfNeighboors[0]=possibleposition[60]; //south
+        		listOfNeighboors[3]=possibleposition[16]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[63])){
+                listOfNeighboors[0]=possibleposition[59]; //south
+                listOfNeighboors[1]=possibleposition[64]; //west
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[64])){
+                listOfNeighboors[0]=possibleposition[57]; //south
+                listOfNeighboors[1]=possibleposition[65]; //west
+        		listOfNeighboors[3]=possibleposition[63]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[65])){
+                listOfNeighboors[0]=possibleposition[56]; //south
+        		listOfNeighboors[3]=possibleposition[64]; //east
+        		return listOfNeighboors[s];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[66])){
+                //Not back in center
+                listOfNeighboors[1]=possibleposition[47]; //west
+        		listOfNeighboors[3]=possibleposition[48]; //east
+        		return listOfNeighboors[s];            
+        	}
+
+
+	}
+
+	
+
+	
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.h
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.h	(revision 12304)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.h	(revision 12304)
@@ -0,0 +1,34 @@
+#ifndef _PacmanPink_H__
+#define _PacmanPink_H__
+
+
+#include "PacmanGhost.h"
+//#include "getShortestPath.h"
+
+
+namespace orxonox {
+
+	class _OrxonoxExport PacmanPink : public PacmanGhost{
+
+		public :
+			PacmanPink(Context* context);
+
+			virtual void tick(float dt) override; //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+  			virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+  			void setNewTargetPink(Vector3 goalToGo);
+
+  			void nextMove(Vector3 playerPos, Vector3 redPos);
+
+  			int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos);
+
+  			Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE);
+
+  			Vector3 diffVector (Vector3 start, Vector3 goal);
+
+	};
+
+}
+
+#endif 
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRandom.cc
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRandom.cc	(revision 12303)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRandom.cc	(revision 12304)
@@ -1,23 +1,273 @@
-
-	#include "PacmanGhost.h"
-
-
-	namespace orxonox{
-	class PacmanRandom : public PacmanGhost {
-
-		public:
-
-           /* int decision=0;
-            int target_x = 0; 
-            int target_z = 0;
-            bool ismoving = false;
-            bool lockmove = false;*/
-
-
-		//Random choice of new target (not used in game, but useful)
-    void setnewTarget(int firstdec){ 
-    //setNewTarget in PacmanGhost seems to be private so we need it here too
-        
-    	  decision = rand()%1;
+#include "PacmanRandom.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+
+
+
+namespace orxonox {
+
+
+    RegisterClass(PacmanRandom);
+
+
+
+    PacmanRandom::PacmanRandom(Context* context) : PacmanGhost(context){
+
+        RegisterObject(PacmanRandom);
+        
+        
+    }
+
+        /**
+    @brief
+        Method for creating a ghost through XML.
+    */
+    void PacmanRandom::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(PacmanRandom, XMLPort, xmlelement, mode);
+    }
+
+    void PacmanRandom::tick(float dt)
+    {
+        SUPER(PacmanGhost, tick, dt);
+
+        this->actuelposition = this->getPosition();
+        
+        //Stop, if target arrived
+        if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){
+                 this->ismoving = false;
+        }
+
+        //Move, if ghost hasn't arrived yet
+        if(this->ismoving){
+            if(!(abs(this->actuelposition.z-target_z)<0.5)) {
+                velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
+                move(dt, actuelposition, velocity);
+            }    
+            if(!(abs(this->actuelposition.x-target_x)<0.5)){
+                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
+                move(dt, actuelposition, velocity);
+            }
+        }
+        //Check on which position the ghost has arrived and set new target
+         else{
+            while(lockmove){};
+            lockmove = true;
+
+            if(findpos(actuelposition,possibleposition[0])){
+                setnewTarget(1,17,19);
+            }
+            else if(findpos(actuelposition,possibleposition[1])){
+                setnewTarget(0,2);
+            }
+            else if(findpos(actuelposition,possibleposition[2])){
+                setnewTarget(1,3);
+            }
+            else if(findpos(actuelposition,possibleposition[3])){
+                setnewTarget(2,4,5);
+            }
+            else if(findpos(actuelposition,possibleposition[4])){
+                setnewTarget(3,6);
+            }
+            else if(findpos(actuelposition,possibleposition[5])){
+                setnewTarget(3,7);
+            }
+            else if(findpos(actuelposition,possibleposition[6])){
+                setnewTarget(4,9,26);
+            }
+            else if(findpos(actuelposition,possibleposition[7])){
+                setnewTarget(5,8);
+            }
+            else if(findpos(actuelposition,possibleposition[8])){
+                setnewTarget(7,9);
+            }
+            else if(findpos(actuelposition,possibleposition[9])){
+                setnewTarget(6,8,10,38);
+            }
+            else if(findpos(actuelposition,possibleposition[10])){
+                setnewTarget(9,11,45);
+            }
+            else if(findpos(actuelposition,possibleposition[11])){
+                setnewTarget(10,12,13);
+            }
+            else if(findpos(actuelposition,possibleposition[12])){
+                setnewTarget(11,14);
+            }
+            else if(findpos(actuelposition,possibleposition[13])){
+                setnewTarget(11,14,16,61);
+            }
+            else if(findpos(actuelposition,possibleposition[14])){
+                setnewTarget(12,13,15);
+            }
+            else if(findpos(actuelposition,possibleposition[15])){
+                setnewTarget(14,16);
+            }
+            else if(findpos(actuelposition,possibleposition[16])){
+                setnewTarget(13,15,62);
+            }
+            else if(findpos(actuelposition,possibleposition[17])){
+                setnewTarget(0,25);
+            }
+            else if(findpos(actuelposition,possibleposition[18])){
+                setnewTarget(19,24);
+            }
+            else if(findpos(actuelposition,possibleposition[19])){
+                setnewTarget(0,18,20);
+            }
+            else if(findpos(actuelposition,possibleposition[20])){
+                setnewTarget(19,21);
+            }
+            else if(findpos(actuelposition,possibleposition[21])){
+                setnewTarget(20,22);
+            }
+            else if(findpos(actuelposition,possibleposition[22])){
+                setnewTarget(21,23,31);
+            }
+            else if(findpos(actuelposition,possibleposition[23])){
+                setnewTarget(22,30);
+            }
+            else if(findpos(actuelposition,possibleposition[24])){
+                setnewTarget(18,29);
+            }
+            else if(findpos(actuelposition,possibleposition[25])){
+                setnewTarget(17,26);
+            }
+            else if(findpos(actuelposition,possibleposition[26])){
+                setnewTarget(6,25,27);
+            }
+            else if(findpos(actuelposition,possibleposition[27])){
+                setnewTarget(26,28,37);
+            }
+            else if(findpos(actuelposition,possibleposition[28])){
+                setnewTarget(27,29,36);
+            }
+            else if(findpos(actuelposition,possibleposition[29])){
+                setnewTarget(24,28,30);
+            }
+            else if(findpos(actuelposition,possibleposition[30])){
+                setnewTarget(23,29,34);
+            }
+            else if(findpos(actuelposition,possibleposition[31])){
+                setnewTarget(22,32);
+            }
+            else if(findpos(actuelposition,possibleposition[32])){
+                setnewTarget(31,33);
+            }
+            else if(findpos(actuelposition,possibleposition[33])){
+                setnewTarget(32,34);
+            }
+            else if(findpos(actuelposition,possibleposition[34])){
+                setnewTarget(30,33,35,42);
+            }
+            else if(findpos(actuelposition,possibleposition[35])){
+                setnewTarget(34,36,41);
+            }
+            else if(findpos(actuelposition,possibleposition[36])){
+                setnewTarget(28,35);
+            }
+            else if(findpos(actuelposition,possibleposition[37])){
+                setnewTarget(27,38);
+            }
+            else if(findpos(actuelposition,possibleposition[38])){
+                setnewTarget(9,37,39);
+            }
+            else if(findpos(actuelposition,possibleposition[39])){
+                setnewTarget(38,40,45);
+            }
+            else if(findpos(actuelposition,possibleposition[40])){
+                setnewTarget(39,41); //Shouldn't be able to return in center
+            }
+            else if(findpos(actuelposition,possibleposition[41])){
+                setnewTarget(35,43);
+            }
+            else if(findpos(actuelposition,possibleposition[42])){
+                setnewTarget(34,43,54);
+            }
+            else if(findpos(actuelposition,possibleposition[43])){
+                setnewTarget(41,46);
+            }
+            else if(findpos(actuelposition,possibleposition[44])){
+                setnewTarget(40,66);
+            }
+            else if(findpos(actuelposition,possibleposition[45])){
+                setnewTarget(10,39,49);
+            }
+            else if(findpos(actuelposition,possibleposition[46])){
+                setnewTarget(43,47);
+            }
+            else if(findpos(actuelposition,possibleposition[47])){
+                setnewTarget(46,52,66);
+            }
+            else if(findpos(actuelposition,possibleposition[48])){
+                setnewTarget(49,51,66);
+            }
+            else if(findpos(actuelposition,possibleposition[49])){
+                setnewTarget(45,48);
+            }
+            else if(findpos(actuelposition,possibleposition[50])){
+                setnewTarget(51,61);
+            }
+            else if(findpos(actuelposition,possibleposition[51])){
+                setnewTarget(48,50);
+            }
+            else if(findpos(actuelposition,possibleposition[52])){
+                setnewTarget(47,53);
+            }
+            else if(findpos(actuelposition,possibleposition[53])){
+                setnewTarget(52,58);
+            }
+            else if(findpos(actuelposition,possibleposition[54])){
+                setnewTarget(42,55,57);
+            }
+            else if(findpos(actuelposition,possibleposition[55])){
+                setnewTarget(54,56);
+            }
+            else if(findpos(actuelposition,possibleposition[56])){
+                setnewTarget(55,57,65);
+            }
+            else if(findpos(actuelposition,possibleposition[57])){
+                setnewTarget(54,56,58,64);
+            }
+            else if(findpos(actuelposition,possibleposition[58])){
+                setnewTarget(53,57,59);
+            }
+            else if(findpos(actuelposition,possibleposition[59])){
+                setnewTarget(58,59,63);
+            }
+            else if(findpos(actuelposition,possibleposition[60])){
+                setnewTarget(59,61,62);
+            }
+            else if(findpos(actuelposition,possibleposition[61])){
+                setnewTarget(13,50,60);
+            }
+            else if(findpos(actuelposition,possibleposition[62])){
+                setnewTarget(16,60);
+            }
+            else if(findpos(actuelposition,possibleposition[63])){
+                setnewTarget(59,64);
+            }
+            else if(findpos(actuelposition,possibleposition[64])){
+                setnewTarget(57,63,65);
+            }
+            else if(findpos(actuelposition,possibleposition[65])){
+                setnewTarget(56,64);
+            }
+            else if(findpos(actuelposition,possibleposition[66])){
+                setnewTarget(47,48);
+            }
+
+            else{
+                this->resetGhost(); //Shouldn't happen...
+            } //End of Position table
+                lockmove = false;
+            }
+        
+    }
+
+    void PacmanRandom::setnewTarget(int firstdec){
+        
+          decision = rand()%1;
             switch(decision){
                 case 0:
@@ -26,11 +276,10 @@
                     this->ismoving = true;
                     break;
-    		}
-    }	
-
+            }
+    }
 
     //Random choice of new target
-    void setnewTarget(int firstdec, int seconddec){ 
-    	   decision = rand()%2;
+    void PacmanRandom::setnewTarget(int firstdec, int seconddec){ 
+           decision = rand()%2;
             switch(decision){
                 case 0:
@@ -49,7 +298,7 @@
 
     //Random choice of new target
-    void setnewTarget(int firstdec, int seconddec, int thirddec){
-        
-    	   decision = rand()%3;
+    void PacmanRandom::setnewTarget(int firstdec, int seconddec, int thirddec){
+        
+           decision = rand()%3;
             switch(decision){
                 case 0:
@@ -68,12 +317,12 @@
                     this->ismoving = true;
                     break;    
-    		}
+            }
             
-	}
+    }
 
     //Random choice of new target
-    void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec){
-        
-    	   decision = rand()%4;
+    void PacmanRandom::setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec){
+        
+           decision = rand()%4;
             switch(decision){
                 case 0:
@@ -93,243 +342,12 @@
                     break;
                 case 3:
-                	this->target_x = possibleposition[fourthdec].x;
+                    this->target_x = possibleposition[fourthdec].x;
                     this->target_z = possibleposition[fourthdec].z; 
                     this->ismoving = true;
                     break;    
-    		}
+            }
             
-	}
-
-	void tick(float dt){
-
-		PacmanGhost::tick(dt);
-
-
-		if(!(this->ismoving)){
-
-            while(lockmove){};
-            lockmove = true;
-
-            if(findpos(actuelposition,possibleposition[0])){
-            	setnewTarget(1,17,19);
-            }
-            else if(findpos(actuelposition,possibleposition[1])){
-            	setnewTarget(0,2);
-            }
-            else if(findpos(actuelposition,possibleposition[2])){
-        		setnewTarget(1,3);
-            }
-            else if(findpos(actuelposition,possibleposition[3])){
-			    setnewTarget(2,4,5);
-            }
-            else if(findpos(actuelposition,possibleposition[4])){
-				setnewTarget(3,6);
-            }
-            else if(findpos(actuelposition,possibleposition[5])){
-            	setnewTarget(3,7);
-            }
-            else if(findpos(actuelposition,possibleposition[6])){
-                setnewTarget(4,9,26);
-            }
-            else if(findpos(actuelposition,possibleposition[7])){
-                setnewTarget(5,8);
-            }
-            else if(findpos(actuelposition,possibleposition[8])){
-                setnewTarget(7,9);
-            }
-            else if(findpos(actuelposition,possibleposition[9])){
-                setnewTarget(6,8,10,38);
-            }
-            else if(findpos(actuelposition,possibleposition[10])){
-                setnewTarget(9,11,45);
-            }
-            else if(findpos(actuelposition,possibleposition[11])){
-                setnewTarget(10,12,13);
-            }
-            else if(findpos(actuelposition,possibleposition[12])){
-                setnewTarget(11,14);
-            }
-            else if(findpos(actuelposition,possibleposition[13])){
-                setnewTarget(11,14,16,61);
-            }
-            else if(findpos(actuelposition,possibleposition[14])){
-                setnewTarget(12,13,15);
-            }
-            else if(findpos(actuelposition,possibleposition[15])){
-                setnewTarget(14,16);
-            }
-            else if(findpos(actuelposition,possibleposition[16])){
-                setnewTarget(13,15,62);
-            }
-            else if(findpos(actuelposition,possibleposition[17])){
-                setnewTarget(0,25);
-            }
-            else if(findpos(actuelposition,possibleposition[18])){
-                setnewTarget(19,24);
-            }
-            else if(findpos(actuelposition,possibleposition[19])){
-                setnewTarget(0,18,20);
-            }
-            else if(findpos(actuelposition,possibleposition[20])){
-                setnewTarget(19,21);
-            }
-            else if(findpos(actuelposition,possibleposition[21])){
-                setnewTarget(20,22);
-            }
-            else if(findpos(actuelposition,possibleposition[22])){
-                setnewTarget(21,23,31);
-            }
-            else if(findpos(actuelposition,possibleposition[23])){
-                setnewTarget(22,30);
-            }
-            else if(findpos(actuelposition,possibleposition[24])){
-                setnewTarget(18,29);
-            }
-            else if(findpos(actuelposition,possibleposition[25])){
-                setnewTarget(17,26);
-            }
-            else if(findpos(actuelposition,possibleposition[26])){
-                setnewTarget(6,25,27);
-            }
-            else if(findpos(actuelposition,possibleposition[27])){
-                setnewTarget(26,28,37);
-            }
-            else if(findpos(actuelposition,possibleposition[28])){
-                setnewTarget(27,29,36);
-            }
-            else if(findpos(actuelposition,possibleposition[29])){
-                setnewTarget(24,28,30);
-            }
-            else if(findpos(actuelposition,possibleposition[30])){
-                setnewTarget(23,29,34);
-            }
-            else if(findpos(actuelposition,possibleposition[31])){
-                setnewTarget(22,32);
-            }
-            else if(findpos(actuelposition,possibleposition[32])){
-                setnewTarget(31,33);
-            }
-            else if(findpos(actuelposition,possibleposition[33])){
-                setnewTarget(32,34);
-            }
-            else if(findpos(actuelposition,possibleposition[34])){
-                setnewTarget(30,33,35,42);
-            }
-            else if(findpos(actuelposition,possibleposition[35])){
-                setnewTarget(34,36,41);
-            }
-            else if(findpos(actuelposition,possibleposition[36])){
-                setnewTarget(28,35);
-            }
-            else if(findpos(actuelposition,possibleposition[37])){
-                setnewTarget(27,38);
-            }
-            else if(findpos(actuelposition,possibleposition[38])){
-                setnewTarget(9,37,39);
-            }
-            else if(findpos(actuelposition,possibleposition[39])){
-                setnewTarget(38,40,45);
-            }
-            else if(findpos(actuelposition,possibleposition[40])){
-                setnewTarget(39,41); //Shouldn't be able to return in center
-            }
-            else if(findpos(actuelposition,possibleposition[41])){
-                setnewTarget(35,43);
-            }
-            else if(findpos(actuelposition,possibleposition[42])){
-                setnewTarget(34,43,54);
-            }
-            else if(findpos(actuelposition,possibleposition[43])){
-                setnewTarget(41,46);
-            }
-            else if(findpos(actuelposition,possibleposition[44])){
-                setnewTarget(40,66);
-            }
-            else if(findpos(actuelposition,possibleposition[45])){
-                setnewTarget(10,39,49);
-            }
-            else if(findpos(actuelposition,possibleposition[46])){
-                setnewTarget(43,47);
-            }
-            else if(findpos(actuelposition,possibleposition[47])){
-                setnewTarget(46,52,66);
-            }
-            else if(findpos(actuelposition,possibleposition[48])){
-                setnewTarget(49,51,66);
-            }
-            else if(findpos(actuelposition,possibleposition[49])){
-                setnewTarget(45,48);
-            }
-            else if(findpos(actuelposition,possibleposition[50])){
-                setnewTarget(51,61);
-            }
-            else if(findpos(actuelposition,possibleposition[51])){
-                setnewTarget(48,50);
-            }
-            else if(findpos(actuelposition,possibleposition[52])){
-                setnewTarget(47,53);
-            }
-            else if(findpos(actuelposition,possibleposition[53])){
-                setnewTarget(52,58);
-            }
-            else if(findpos(actuelposition,possibleposition[54])){
-                setnewTarget(42,55,57);
-            }
-            else if(findpos(actuelposition,possibleposition[55])){
-                setnewTarget(54,56);
-            }
-            else if(findpos(actuelposition,possibleposition[56])){
-                setnewTarget(55,57,65);
-            }
-            else if(findpos(actuelposition,possibleposition[57])){
-                setnewTarget(54,56,58,64);
-            }
-            else if(findpos(actuelposition,possibleposition[58])){
-                setnewTarget(53,57,59);
-            }
-            else if(findpos(actuelposition,possibleposition[59])){
-                setnewTarget(58,59,63);
-            }
-            else if(findpos(actuelposition,possibleposition[60])){
-                setnewTarget(59,61,62);
-            }
-            else if(findpos(actuelposition,possibleposition[61])){
-                setnewTarget(13,50,60);
-            }
-            else if(findpos(actuelposition,possibleposition[62])){
-                setnewTarget(16,60);
-            }
-            else if(findpos(actuelposition,possibleposition[63])){
-                setnewTarget(59,64);
-            }
-            else if(findpos(actuelposition,possibleposition[64])){
-                setnewTarget(57,63,65);
-            }
-            else if(findpos(actuelposition,possibleposition[65])){
-                setnewTarget(56,64);
-            }
-            else if(findpos(actuelposition,possibleposition[66])){
-                setnewTarget(47,48);
-            }
-
-            else{
-                this->resetGhost(); //Shouldn't happen...
-            } //End of Position table
-                lockmove = false;
-        }
-
-        //end of function
-
-
-	}
-
-		private:
-
-
-
-			//end of class
-	};
-
-
-	//namespae orxonox
-	}
+    }
+
+
+}
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRandom.h
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRandom.h	(revision 12304)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRandom.h	(revision 12304)
@@ -0,0 +1,26 @@
+#ifndef _PacmanRandom_H__
+#define _PacmanRandom_H__
+
+#include "PacmanGhost.h"
+
+namespace orxonox {
+
+  class _OrxonoxExport PacmanRandom : public PacmanGhost{
+
+  		public:
+  			PacmanRandom(Context* context);
+
+  			virtual void tick(float dt) override; //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+  			virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+  			void setnewTarget(int firstdec);
+            void setnewTarget(int firstdec, int seconddec);
+            void setnewTarget(int firstdec, int seconddec, int thirddec);
+            void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec);
+  };
+
+
+}
+
+
+#endif 
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	(revision 12304)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	(revision 12304)
@@ -0,0 +1,101 @@
+#include "PacmanRed.h"
+//#include "Pacman.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+	namespace orxonox{
+
+		RegisterClass(PacmanRed);
+
+		PacmanRed::PacmanRed(Context* context) : PacmanGhost(context){
+
+        RegisterObject(PacmanRed);
+          
+    }
+
+
+    /**
+    @brief
+        Method for creating a ghost through XML.
+    */
+    void PacmanRed::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(PacmanRed, XMLPort, xmlelement, mode);
+    }
+
+    void PacmanRed::tick(float dt)
+    {
+        SUPER(PacmanGhost, tick, dt);
+
+        this->actuelposition = this->getPosition();
+        
+        //Stop, if target arrived
+        if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){
+                 this->ismoving = false;
+        }
+
+        //Move, if ghost hasn't arrived yet
+        if(this->ismoving){
+            if(!(abs(this->actuelposition.z-target_z)<0.5)) {
+                velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
+                move(dt, actuelposition, velocity);
+            }    
+            if(!(abs(this->actuelposition.x-target_x)<0.5)){
+                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
+                move(dt, actuelposition, velocity);
+            }
+        }
+        
+        //Check on which position the ghost has arrived and set new target
+        else{
+
+            while(lockmove){};
+            lockmove = true;
+
+        	//do red behavior
+
+            Vector3 purePos = setPureArrayPos(this->actuelposition); 
+            //find nearest position on the map to red pos if pacman does not move,
+            //i.e. reached a point on the map
+            //Why not simply use target_x and target_z ??????
+
+            nextMove(purePos, player.actuelposition);
+            //how do we access the PLAYER variable ??????
+
+            //also, player.lastPassedPoint is maybe better
+        }
+        
+    }
+
+
+	void PacmanRed::setNewTargetRed(Vector3 goalToGo){
+
+					this->target_x = goalToGo.x;
+                    this->target_z = goalToGo.z; 
+                    this->ismoving = true;
+	}
+
+
+	void PacmanRed::nextMove(Vector3 playerPos, Vector3 redPos){
+		Vector3 nextTarget;
+
+	nextTarget = getShortestPath(playerPos, redPos);
+	
+	setNewTargetRed(nextTarget);
+	}
+
+
+
+    //save last checkpoint crossed by player 
+    /* 
+        void PacmanGelb::tick(float dt){ //last passed point of player
+            for(int u=0; u < 67; u++){
+            if(findpos(this->getPosition(), possibleposition[u])){
+            this->lastPassedPoint=possibleposition[u];
+                    }
+                }
+        }
+    */
+
+}
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.h
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.h	(revision 12304)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.h	(revision 12304)
@@ -0,0 +1,32 @@
+#ifndef _PacmanRed_H__
+#define _PacmanRed_H__
+
+
+#include "PacmanGhost.h"
+//#include "getShortestPath.h"
+
+
+namespace orxonox {
+
+	class _OrxonoxExport PacmanRed : public PacmanGhost{
+
+		public :
+			PacmanRed(Context* context);
+
+			virtual void tick(float dt) override; //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+  			virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
+
+  			void setNewTargetRed(Vector3 goalToGo);
+
+  			void nextMove(Vector3 playerPos, Vector3 redPos);
+
+  			void mainBehaviourRed();
+
+
+
+	};
+
+}
+
+#endif 
Index: /code/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.cc
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.cc	(revision 12303)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.cc	(revision 12304)
@@ -1,5 +1,6 @@
     #include "core/CoreIncludes.h"
     #include "core/XMLPort.h"
-    #include "getShortestPath.h"
+    //#include "getShortestPath.h"
+    #include "PacmanGhost.h"
 
 
@@ -9,14 +10,4 @@
     namespace orxonox{
 
-        //Check if there is a collision
-        bool jeanfindpos(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;
-        }
-
-        struct graphVertex;
-        void findNeighboorVertices(Vector3 actuelposition, graphVertex adjacentVertices[]);
-        void updateShortestDistanceToStart(graphVertex &vertex, graphVertex &neighboor);
-        graphVertex findNextVertexToConsider(graphVertex[]);
         struct graphVertex {
 
@@ -57,4 +48,5 @@
         };
 
+        graphVertex listOfVertices[67];
 
         Vector3 getShortestPath(Vector3 start, Vector3 goal){
@@ -66,22 +58,4 @@
             return start;
         }
-
-        //All positions in the map, see documentation
-     Vector3 possibleposition[] = {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
-
-        graphVertex listOfVertices[67]= { graphVertex()};  //list of all vertices in the map. // We need graphVertex()
        
 
@@ -90,5 +64,5 @@
         }
 
-        graphVertex actualVertex;
+        graphVertex actualVertex= graphVertex(start);
 
         actualVertex.alreadyVisited=true;
@@ -168,5 +142,5 @@
 
 
-    graphVertex findNextVertexToConsider(graphVertex listOfVertices[]){ //find next, nearest from start, non visited vertex 
+    graphVertex findNextVertexToConsider(graphVertex listOfVerticesP[]){ //find next, nearest from start, non visited vertex 
 
         int shortestDistance = -1;
@@ -175,29 +149,29 @@
         for(int i=0; i < 67; i++){ //we loop over all possible positions 
 
-            if(listOfVertices[i].alreadyVisited==true){ //vertex should already be visited 
-
-                findNearestNonVisitedNeighboor(listOfVertices[i]); //we update nearest neighboor
+            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(listOfVertices[i].currentNearestNonVisitedNeighboor!=NULL){ //we want a candidate!
+                if(listOfVerticesP[i].currentNearestNonVisitedNeighboor!=NULL){ //we want a candidate!
                 if(shortestDistance==-1){ //our first possible candidate
 
-            shortestDistance=graphDistance(listOfVertices[i].position, 
-            listOfVertices[i].currentNearestNonVisitedNeighboor->position) + 
-            listOfVertices[i].shortestDistanceToStart;
-
-            nextVertexToConsider=listOfVertices[i].currentNearestNonVisitedNeighboor;
-
-                }
-                else if(shortestDistance > graphDistance(listOfVertices[i].position, 
-                listOfVertices[i].currentNearestNonVisitedNeighboor->position) + 
-                    listOfVertices[i].shortestDistanceToStart){
-
-            shortestDistance=graphDistance(listOfVertices[i].position, 
-            listOfVertices[i].currentNearestNonVisitedNeighboor->position) + 
-            listOfVertices[i].shortestDistanceToStart;
-
-            nextVertexToConsider=listOfVertices[i].currentNearestNonVisitedNeighboor;
+            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;
                     }
                 }
@@ -218,334 +192,317 @@
     //-195 -135 -85 -35 15 60 105 150 195 245
 
-    void findNeighboorVertices(Vector3 actuelposition, graphVertex adjacentVertices[]){
-
-            //All positions in the map, see documentation
-     Vector3 possibleposition[] = {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
-        
-
-
-
-            if(jeanfindpos(actuelposition,possibleposition[0])){
+    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]=graphVertex(possibleposition[1]);  //need to do it everywhere !!!
-                adjacentVertices[1]=graphVertex(possibleposition[17]);
-                adjacentVertices[2]=possibleposition[19]; //maybe a vector would be more suitable ?
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[1])){
-                adjacentVertices[0]=possibleposition[0];
-                adjacentVertices[1]=possibleposition[2];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[2])){
-                adjacentVertices[0]=possibleposition[1];
-                adjacentVertices[1]=possibleposition[3];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[3])){
-                adjacentVertices[0]=possibleposition[2];
-                adjacentVertices[1]=possibleposition[4];
-                adjacentVertices[2]=possibleposition[5];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[4])){
-                adjacentVertices[0]=possibleposition[3];
-                adjacentVertices[1]=possibleposition[6];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[5])){
-                adjacentVertices[0]=possibleposition[3];
-                adjacentVertices[1]=possibleposition[7];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[6])){
-                adjacentVertices[0]=possibleposition[4];
-                adjacentVertices[1]=possibleposition[9];
-                adjacentVertices[2]=possibleposition[26];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[7])){
-                adjacentVertices[0]=possibleposition[5];
-                adjacentVertices[1]=possibleposition[8];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[8])){
-                adjacentVertices[0]=possibleposition[7];
-                adjacentVertices[1]=possibleposition[9];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[9])){
-                adjacentVertices[0]=possibleposition[6];
-                adjacentVertices[1]=possibleposition[8];
-                adjacentVertices[2]=possibleposition[10];
-                adjacentVertices[3]=possibleposition[38];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[10])){
-                adjacentVertices[0]=possibleposition[9];
-                adjacentVertices[1]=possibleposition[11];
-                adjacentVertices[2]=possibleposition[45];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[11])){
-                adjacentVertices[0]=possibleposition[10];
-                adjacentVertices[1]=possibleposition[12];
-                adjacentVertices[2]=possibleposition[13];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[12])){
-                adjacentVertices[0]=possibleposition[11];
-                adjacentVertices[1]=possibleposition[14];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[13])){
-                adjacentVertices[0]=possibleposition[11];
-                adjacentVertices[1]=possibleposition[14];
-                adjacentVertices[2]=possibleposition[16];
-                adjacentVertices[3]=possibleposition[61];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[14])){
-                adjacentVertices[0]=possibleposition[12];
-                adjacentVertices[1]=possibleposition[13];
-                adjacentVertices[2]=possibleposition[15];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[15])){
-                adjacentVertices[0]=possibleposition[14];
-                adjacentVertices[1]=possibleposition[16];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[16])){
-                adjacentVertices[0]=possibleposition[13];
-                adjacentVertices[1]=possibleposition[15];
-                adjacentVertices[2]=possibleposition[62];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[17])){
-                adjacentVertices[0]=possibleposition[0];
-                adjacentVertices[1]=possibleposition[25];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[18])){
-                adjacentVertices[0]=possibleposition[19];
-                adjacentVertices[1]=possibleposition[24];                
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[19])){
-                adjacentVertices[0]=possibleposition[0];
-                adjacentVertices[1]=possibleposition[18];
-                adjacentVertices[2]=possibleposition[20];
+                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(jeanfindpos(actuelposition,possibleposition[20])){
-                adjacentVertices[0]=possibleposition[19];
-                adjacentVertices[1]=possibleposition[21];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[21])){
-                adjacentVertices[0]=possibleposition[20];
-                adjacentVertices[1]=possibleposition[22];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[22])){
-                adjacentVertices[0]=possibleposition[21];
-                adjacentVertices[1]=possibleposition[23];
-                adjacentVertices[2]=possibleposition[31];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[23])){
-                adjacentVertices[0]=possibleposition[22];
-                adjacentVertices[1]=possibleposition[30];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[24])){
-                adjacentVertices[0]=possibleposition[18];
-                adjacentVertices[1]=possibleposition[29];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[25])){
-                adjacentVertices[0]=possibleposition[17];
-                adjacentVertices[1]=possibleposition[26];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[26])){
-                adjacentVertices[0]=possibleposition[6];
-                adjacentVertices[1]=possibleposition[25];
-                adjacentVertices[2]=possibleposition[27];
+            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(jeanfindpos(actuelposition,possibleposition[27])){
-                adjacentVertices[0]=possibleposition[26];
-                adjacentVertices[1]=possibleposition[28];
-                adjacentVertices[2]=possibleposition[37];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[28])){
-                adjacentVertices[0]=possibleposition[27];
-                adjacentVertices[1]=possibleposition[29];
-                adjacentVertices[2]=possibleposition[36];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[29])){
-                adjacentVertices[0]=possibleposition[24];
-                adjacentVertices[1]=possibleposition[28];
-                adjacentVertices[2]=possibleposition[30];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[30])){
-                adjacentVertices[0]=possibleposition[23];
-                adjacentVertices[1]=possibleposition[29];
-                adjacentVertices[2]=possibleposition[34];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[31])){
-                adjacentVertices[0]=possibleposition[22];
-                adjacentVertices[1]=possibleposition[32];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[32])){
-                adjacentVertices[0]=possibleposition[31];
-                adjacentVertices[1]=possibleposition[33];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[33])){
-                adjacentVertices[0]=possibleposition[32];
-                adjacentVertices[1]=possibleposition[34];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[34])){
-                adjacentVertices[0]=possibleposition[30];
-                adjacentVertices[1]=possibleposition[33];
-                adjacentVertices[2]=possibleposition[35];
-                adjacentVertices[3]=possibleposition[42];
+            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(jeanfindpos(actuelposition,possibleposition[35])){
-                adjacentVertices[0]=possibleposition[34];
-                adjacentVertices[1]=possibleposition[36];
-                adjacentVertices[2]=possibleposition[41];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[36])){
-                adjacentVertices[0]=possibleposition[28];
-                adjacentVertices[1]=possibleposition[35];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[37])){
-                adjacentVertices[0]=possibleposition[27];
-                adjacentVertices[1]=possibleposition[38];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[38])){
-                adjacentVertices[0]=possibleposition[9];
-                adjacentVertices[1]=possibleposition[37];
-                adjacentVertices[2]=possibleposition[39];
+            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(jeanfindpos(actuelposition,possibleposition[39])){
-                adjacentVertices[0]=possibleposition[38];
-                adjacentVertices[1]=possibleposition[40];
-                adjacentVertices[2]=possibleposition[45];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[40])){
-                adjacentVertices[0]=possibleposition[39];
-                adjacentVertices[1]=possibleposition[41];
-            }
-            else if(jeanfindpos(actuelposition,possibleposition[41])){
-                adjacentVertices[0]=possibleposition[35];
-                adjacentVertices[1]=possibleposition[43];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[42])){
-                adjacentVertices[0]=possibleposition[34];
-                adjacentVertices[1]=possibleposition[43];
-                adjacentVertices[2]=possibleposition[54];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[43])){
-                adjacentVertices[0]=possibleposition[41];
-                adjacentVertices[1]=possibleposition[46];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[44])){
-                adjacentVertices[0]=possibleposition[40];
-                adjacentVertices[1]=possibleposition[66];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[45])){
-                adjacentVertices[0]=possibleposition[10];
-                adjacentVertices[1]=possibleposition[39];
-                adjacentVertices[2]=possibleposition[49];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[46])){
-                adjacentVertices[0]=possibleposition[43];
-                adjacentVertices[1]=possibleposition[47];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[47])){
-                adjacentVertices[0]=possibleposition[46];
-                adjacentVertices[1]=possibleposition[52];
-                adjacentVertices[2]=possibleposition[66];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[48])){
-                adjacentVertices[0]=possibleposition[49];
-                adjacentVertices[1]=possibleposition[51];
-                adjacentVertices[2]=possibleposition[66];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[49])){
-                adjacentVertices[0]=possibleposition[45];
-                adjacentVertices[1]=possibleposition[48];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[50])){
-                adjacentVertices[0]=possibleposition[51];
-                adjacentVertices[1]=possibleposition[61];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[51])){
-                adjacentVertices[0]=possibleposition[48];
-                adjacentVertices[1]=possibleposition[50];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[52])){
-                adjacentVertices[0]=possibleposition[47];
-                adjacentVertices[1]=possibleposition[53];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[53])){
-                adjacentVertices[0]=possibleposition[52];
-                adjacentVertices[1]=possibleposition[58];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[54])){
-                adjacentVertices[0]=possibleposition[42];
-                adjacentVertices[1]=possibleposition[55];
-                adjacentVertices[2]=possibleposition[57];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[55])){
-                adjacentVertices[0]=possibleposition[54];
-                adjacentVertices[1]=possibleposition[56];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[56])){
-                adjacentVertices[0]=possibleposition[55];
-                adjacentVertices[1]=possibleposition[57];
-                adjacentVertices[2]=possibleposition[65];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[57])){
-                adjacentVertices[0]=possibleposition[54];
-                adjacentVertices[1]=possibleposition[56];
-                adjacentVertices[2]=possibleposition[58];
-                adjacentVertices[3]=possibleposition[64];
+            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(jeanfindpos(actuelposition,possibleposition[58])){
-                adjacentVertices[0]=possibleposition[53];
-                adjacentVertices[1]=possibleposition[57];
-                adjacentVertices[2]=possibleposition[59];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[59])){
-                adjacentVertices[0]=possibleposition[58];
-                adjacentVertices[1]=possibleposition[59];
-                adjacentVertices[2]=possibleposition[63];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[60])){
-                adjacentVertices[0]=possibleposition[59];
-                adjacentVertices[1]=possibleposition[61];
-                adjacentVertices[2]=possibleposition[62];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[61])){
-                adjacentVertices[0]=possibleposition[13];
-                adjacentVertices[1]=possibleposition[50];
-                adjacentVertices[2]=possibleposition[60];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[62])){
-                adjacentVertices[0]=possibleposition[16];
-                adjacentVertices[1]=possibleposition[60];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[63])){
-                adjacentVertices[0]=possibleposition[59];
-                adjacentVertices[1]=possibleposition[64];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[64])){
-                adjacentVertices[0]=possibleposition[57];
-                adjacentVertices[1]=possibleposition[63];
-                adjacentVertices[2]=possibleposition[65];
-                          }
-            else if(jeanfindpos(actuelposition,possibleposition[65])){
-                adjacentVertices[0]=possibleposition[56];
-                adjacentVertices[1]=possibleposition[64];
-                       }
-            else if(jeanfindpos(actuelposition,possibleposition[66])){
-                adjacentVertices[0]=possibleposition[47];
-                adjacentVertices[1]=possibleposition[48];
+            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]);
                        }
     }
 
+
 }
Index: de/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.h
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.h	(revision 12303)
+++ 	(revision )
@@ -1,64 +1,0 @@
-    #include "core/CoreIncludes.h"
-    #include "core/XMLPort.h"
-    #include "PacmanGhost.h"
-
-    #include "worldentities/ControllableEntity.h"
-    using namespace std;
-
-namespace orxonox
-{
-
-    class getShortestPath 
-    {
-
-        public:
-
-            //Check if there is a collision
-        bool jeanfindpos(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;
-        }
-        
-
-       private:
-
-        struct graphVertex;
-
-        void findNeighboorVertices(Vector3 actuelposition, graphVertex adjacentVertices[]);
-
-            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
-                }
-            }
-        };
-        
-    };
-
-}
-
