Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	(revision 12322)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	(revision 12323)
@@ -92,6 +92,36 @@
 
             Vector3 brownPos=Vector3(this->target_x, 10, this->target_z);
-
-            if(absoluteDistance(this->lastPlayerPassedPoint, this->actuelposition)<50){
+            std::cout<<brownPos<<endl;
+
+            
+            if(this->isFleeing==true){
+                if(findpos(brownPos, Vector3(-215,10,-195))){
+                    this->isFleeing=false;
+                    //Vector3 nextMoveP = getShortestPath(brownPos, this->lastPlayerPassedPoint);
+                    //this->setNewTargetGhost(nextMoveP);
+                }
+                else{
+                    Vector3 nextMoveP = getShortestPath(brownPos, Vector3(-215,10,-195));
+                    this->setNewTargetGhost(nextMoveP);
+                }
+
+            }
+            else {
+                    Vector3 arrayPlaNeig[4];
+
+                    findNeighboorPositions(this->lastPlayerPassedPoint, arrayPlaNeig, possibleposition);
+                    if(isAdjacentToPlayerLastPastPoint(brownPos, arrayPlaNeig)){
+                        this->isFleeing=true;
+                    }
+                    else{
+                        Vector3 nextMove = getShortestPath(brownPos, this->lastPlayerPassedPoint);        
+                        setNewTargetGhost(nextMove);
+                    }
+
+            }
+            std::cout<<this->isFleeing<<endl;
+
+
+            /*if(absoluteDistance(this->lastPlayerPassedPoint, this->actuelposition)<50){
                 //no idea if 50 is large enough 
 
@@ -123,5 +153,5 @@
                 std::cout<<"fleeing"<<endl;
             }
-        }
+        }*/
 
 
@@ -155,5 +185,5 @@
    
         }
-
+}
 
 
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	(revision 12322)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	(revision 12323)
@@ -711,5 +711,5 @@
             else if(findpos(actuelposition,possibleposition[59])){
                 adjacentVertices[0]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);
-                adjacentVertices[1]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);
+                adjacentVertices[1]=&listOfVerticesP2[60]; //graphVertex(possibleposition[59]);
                 adjacentVertices[2]=&listOfVerticesP2[63]; //graphVertex(possibleposition[63]);
                           }
Index: /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
===================================================================
--- /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	(revision 12322)
+++ /code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	(revision 12323)
@@ -45,7 +45,11 @@
 
         for(int u=0; u < 67; u++){//always check if player passed a point
-            if(jeanfindpos(this->getPlayerPos(), possibleposition[u])){
-            this->lastPlayerPassedPoint=possibleposition[u];
-                    }
+            //if(possibleposition[u]!=Vector3(0,10,15)){
+                if(jeanfindpos(this->getPlayerPos(), possibleposition[u])){
+                    //if(!findpos(possibleposition[u],Vector3(0,10,15))){
+                this->lastPlayerPassedPoint=possibleposition[u];
+                            }
+                        //}
+                //}
             }
 
@@ -125,5 +129,7 @@
                 std::cout<<this->actuelposition<<endl;*/
 
+                //if(!findpos(pointInFrontOfPlayer, Vector3(0,10,15))){
                 nextMove(lastPlayerPassedPoint, pointInFrontOfPlayer);
+                    //}
                 std::cout<<"ogslodm"<<endl;
             }
