Index: code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	(revision 12321)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	(revision 12322)
@@ -13,4 +13,8 @@
 
         RegisterObject(PacmanBrown);
+
+        this->target_x=0;
+        this->target_z=15;
+        this->lastPlayerPassedPoint=Vector3(0,0,0); //Vector3(70,10,-135);
           
     }
@@ -29,5 +33,5 @@
 
 
-        Ogre::Vector3 diffVector;
+        Vector3 diffVector;
         diffVector.x=pos2.x-pos1.x;
         diffVector.y=pos2.y-pos1.y; //should always be 0
@@ -43,4 +47,12 @@
 
         this->actuelposition = this->getPosition();
+
+
+        for(int u=0; u < 67; u++){//always check if player passed a point
+            if(jeanfindpos(this->getPlayerPos(), possibleposition[u])){
+            this->lastPlayerPassedPoint=possibleposition[u];
+                    }
+            }
+
         
         //Stop, if target arrived
@@ -60,8 +72,17 @@
             }
         }
+        else if(this->lastPlayerPassedPoint==Vector3(0,0,0)){
+            //as long as the player has not started the game,
+            //i.e. lastPlayerPastPoint is (0,0,0), brown pacman
+            //cannot possibly move, because it needs the position
+            //of the player to move accordingly
+
+            this->ismoving=false;
+            std::cout<<"weie"<<endl;
+        }
         
         //Check on which position the ghost has arrived and set new target
         else{
-
+            std::cout<<"naye"<<endl;
         	while(lockmove){};
             lockmove = true;
@@ -83,10 +104,10 @@
             }
 
-            else if((this->isFleeing==true)&&(brownPos!=Vector3(-215,10,-195))){
+            else if((this->isFleeing==true)&&(!findpos(brownPos,Vector3(-215,10,-195)))){
                 //if fleeing, continue to flee
              Vector3 nextMove = getShortestPath(brownPos, Vector3(-215, 10, -195));
              setNewTargetGhost(nextMove);
         }
-            else if ((this->isFleeing==true)&&(brownPos==Vector3(-215,10,-195))){
+            else if ((this->isFleeing==true)&&(findpos(brownPos,Vector3(-215,10,-195)))){
                 //if fleeing and reached flee point, go back near player
             this->isFleeing=false;
@@ -98,4 +119,7 @@
                 Vector3 nextMove = getShortestPath(brownPos, this->lastPlayerPassedPoint);
             setNewTargetGhost(nextMove);
+            }
+            if(this->isFleeing){
+                std::cout<<"fleeing"<<endl;
             }
         }
@@ -131,13 +155,339 @@
    
         }
+
+
+
+    bool PacmanBrown::isAdjacentToPlayerLastPastPoint(Vector3 pacmanBrownPos, Vector3 arrayForNeighborPositions[]){
+            //return true if brownPacman is on an adjacent position to the last
+            //point visited by the player. return false otherwise.
+
+            for(int i =0; i < 4; i++){
+                if(arrayForNeighborPositions[i]!=Vector3(0,0,0)){
+                    if(findpos(pacmanBrownPos, arrayForNeighborPositions[i])){
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+
+
+
+        void PacmanBrown::findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]){      
+            //this function should put in adjacentPosition[] the neighboors of lastPlayerPastPoint
+
+            if(findpos(actuelposition,possibleposition[0])){
+                
+
+                adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]);  //need to do it everywhere !!!
+                adjacentPositions[1]=positionArray[17]; //graphVertex(possibleposition[17]);
+                adjacentPositions[2]=positionArray[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ?
+            }
+            else if(findpos(actuelposition,possibleposition[1])){
+                adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
+                adjacentPositions[1]=positionArray[2]; //graphVertex(possibleposition[2]);
+            }
+            else if(findpos(actuelposition,possibleposition[2])){
+                adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]);
+                adjacentPositions[1]=positionArray[3]; //graphVertex(possibleposition[3]);
+            }
+            else if(findpos(actuelposition,possibleposition[3])){
+                adjacentPositions[0]=positionArray[2]; //graphVertex(possibleposition[2]);
+                adjacentPositions[1]=positionArray[4]; //graphVertex(possibleposition[4]);
+                adjacentPositions[2]=positionArray[5]; //graphVertex(possibleposition[5]);
+            }
+            else if(findpos(actuelposition,possibleposition[4])){
+                adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);
+                adjacentPositions[1]=positionArray[6]; //graphVertex(possibleposition[6]);
+            }
+            else if(findpos(actuelposition,possibleposition[5])){
+                adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);
+                adjacentPositions[1]=positionArray[7]; //graphVertex(possibleposition[7]);
+            }
+            else if(findpos(actuelposition,possibleposition[6])){
+                adjacentPositions[0]=positionArray[4]; //graphVertex(possibleposition[4]);
+                adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);
+                adjacentPositions[2]=positionArray[26]; //graphVertex(possibleposition[26]);
+            }
+            else if(findpos(actuelposition,possibleposition[7])){
+                adjacentPositions[0]=positionArray[5]; //graphVertex(possibleposition[5]);
+                adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);
+            }
+            else if(findpos(actuelposition,possibleposition[8])){
+                adjacentPositions[0]=positionArray[7]; //graphVertex(possibleposition[7]);
+                adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);
+            }
+            else if(findpos(actuelposition,possibleposition[9])){
+                adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);
+                adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);
+                adjacentPositions[2]=positionArray[10]; //graphVertex(possibleposition[10]);
+                adjacentPositions[3]=positionArray[38]; //graphVertex(possibleposition[38]);
+            }
+            else if(findpos(actuelposition,possibleposition[10])){
+                adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);
+                adjacentPositions[1]=positionArray[11]; //graphVertex(possibleposition[11]);
+                adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);
+            }
+            else if(findpos(actuelposition,possibleposition[11])){
+                adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);
+                adjacentPositions[1]=positionArray[12]; //graphVertex(possibleposition[12]);
+                adjacentPositions[2]=positionArray[13]; //graphVertex(possibleposition[13]);
+            }
+            else if(findpos(actuelposition,possibleposition[12])){
+                adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);
+                adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);
+            }
+            else if(findpos(actuelposition,possibleposition[13])){
+                adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);
+                adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);
+                adjacentPositions[2]=positionArray[16]; //graphVertex(possibleposition[16]);
+                adjacentPositions[3]=positionArray[61]; //graphVertex(possibleposition[61]);
+            }
+            else if(findpos(actuelposition,possibleposition[14])){
+                adjacentPositions[0]=positionArray[12]; //graphVertex(possibleposition[12]);
+                adjacentPositions[1]=positionArray[13]; //graphVertex(possibleposition[13]);
+                adjacentPositions[2]=positionArray[15]; //graphVertex(possibleposition[15]);
+            }
+            else if(findpos(actuelposition,possibleposition[15])){
+                adjacentPositions[0]=positionArray[14]; //graphVertex(possibleposition[14]);
+                adjacentPositions[1]=positionArray[16]; //graphVertex(possibleposition[16]);
+            }
+            else if(findpos(actuelposition,possibleposition[16])){
+                adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);
+                adjacentPositions[1]=positionArray[15]; //graphVertex(possibleposition[15]);
+                adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);
+            }
+            else if(findpos(actuelposition,possibleposition[17])){
+                adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
+                adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);
+            }
+            else if(findpos(actuelposition,possibleposition[18])){
+                adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);
+                adjacentPositions[1]=positionArray[24]; //graphVertex(possibleposition[24]);                
+            }
+            else if(findpos(actuelposition,possibleposition[19])){
+                adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);
+                adjacentPositions[1]=positionArray[18]; //graphVertex(possibleposition[18]);
+                adjacentPositions[2]=positionArray[20]; //graphVertex(possibleposition[20]);
+                         }
+            else if(findpos(actuelposition,possibleposition[20])){
+                adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);
+                adjacentPositions[1]=positionArray[21]; //graphVertex(possibleposition[21]);
+                       }
+            else if(findpos(actuelposition,possibleposition[21])){
+                adjacentPositions[0]=positionArray[20]; //graphVertex(possibleposition[20]);
+                adjacentPositions[1]=positionArray[22]; //graphVertex(possibleposition[22]);
+                       }
+            else if(findpos(actuelposition,possibleposition[22])){
+                adjacentPositions[0]=positionArray[21]; //graphVertex(possibleposition[21]);
+                adjacentPositions[1]=positionArray[23]; //graphVertex(possibleposition[23]);
+                adjacentPositions[2]=positionArray[31]; //graphVertex(possibleposition[31]);
+                          }
+            else if(findpos(actuelposition,possibleposition[23])){
+                adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);
+                adjacentPositions[1]=positionArray[30]; //graphVertex(possibleposition[30]);
+                       }
+            else if(findpos(actuelposition,possibleposition[24])){
+                adjacentPositions[0]=positionArray[18]; //graphVertex(possibleposition[18]);
+                adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
+                       }
+            else if(findpos(actuelposition,possibleposition[25])){
+                adjacentPositions[0]=positionArray[17]; //graphVertex(possibleposition[17]);
+                adjacentPositions[1]=positionArray[26]; //graphVertex(possibleposition[26]);
+                       }
+            else if(findpos(actuelposition,possibleposition[26])){
+                adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);
+                adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);
+                adjacentPositions[2]=positionArray[27]; //graphVertex(possibleposition[27]);
+                         }
+            else if(findpos(actuelposition,possibleposition[27])){
+                adjacentPositions[0]=positionArray[26]; //graphVertex(possibleposition[26]);
+                adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);
+                adjacentPositions[2]=positionArray[37]; //graphVertex(possibleposition[37]);
+                          }
+            else if(findpos(actuelposition,possibleposition[28])){
+                adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);
+                adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
+                adjacentPositions[2]=positionArray[36]; //graphVertex(possibleposition[36]);
+                          }
+            else if(findpos(actuelposition,possibleposition[29])){
+                adjacentPositions[0]=positionArray[24]; //graphVertex(possibleposition[24]);
+                adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);
+                adjacentPositions[2]=positionArray[30]; //graphVertex(possibleposition[30]);
+                          }
+            else if(findpos(actuelposition,possibleposition[30])){
+                adjacentPositions[0]=positionArray[23]; //graphVertex(possibleposition[23]);
+                adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);
+                adjacentPositions[2]=positionArray[34]; //graphVertex(possibleposition[34]);
+                          }
+            else if(findpos(actuelposition,possibleposition[31])){
+                adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);
+                adjacentPositions[1]=positionArray[32]; //graphVertex(possibleposition[32]);
+                       }
+            else if(findpos(actuelposition,possibleposition[32])){
+                adjacentPositions[0]=positionArray[31]; //graphVertex(possibleposition[31]);
+                adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);
+                       }
+            else if(findpos(actuelposition,possibleposition[33])){
+                adjacentPositions[0]=positionArray[32]; //graphVertex(possibleposition[32]);
+                adjacentPositions[1]=positionArray[34]; //graphVertex(possibleposition[34]);
+                       }
+            else if(findpos(actuelposition,possibleposition[34])){
+                adjacentPositions[0]=positionArray[30]; //graphVertex(possibleposition[30]);
+                adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);
+                adjacentPositions[2]=positionArray[35]; //graphVertex(possibleposition[35]);
+                adjacentPositions[3]=positionArray[42]; //graphVertex(possibleposition[42]);
+                
+            }
+            else if(findpos(actuelposition,possibleposition[35])){
+                adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);
+                adjacentPositions[1]=positionArray[36]; //graphVertex(possibleposition[36]);
+                adjacentPositions[2]=positionArray[41]; //graphVertex(possibleposition[41]);
+                          }
+            else if(findpos(actuelposition,possibleposition[36])){
+                adjacentPositions[0]=positionArray[28]; //graphVertex(possibleposition[28]);
+                adjacentPositions[1]=positionArray[35]; //graphVertex(possibleposition[35]);
+                       }
+            else if(findpos(actuelposition,possibleposition[37])){
+                adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);
+                adjacentPositions[1]=positionArray[38]; //graphVertex(possibleposition[38]);
+                       }
+            else if(findpos(actuelposition,possibleposition[38])){
+                adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);
+                adjacentPositions[1]=positionArray[37]; //graphVertex(possibleposition[37]);
+                adjacentPositions[2]=positionArray[39]; //graphVertex(possibleposition[39]);
+                         }
+            else if(findpos(actuelposition,possibleposition[39])){
+                adjacentPositions[0]=positionArray[38]; //graphVertex(possibleposition[38]);
+                adjacentPositions[1]=positionArray[40]; //graphVertex(possibleposition[40]);
+                adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);
+                          }
+            else if(findpos(actuelposition,possibleposition[40])){
+                adjacentPositions[0]=positionArray[39]; //graphVertex(possibleposition[39]);
+                adjacentPositions[1]=positionArray[41]; //graphVertex(possibleposition[41]);
+            }
+            else if(findpos(actuelposition,possibleposition[41])){
+                adjacentPositions[0]=positionArray[35]; //graphVertex(possibleposition[35]);
+                adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);
+                       }
+            else if(findpos(actuelposition,possibleposition[42])){
+                adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);
+                adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);
+                adjacentPositions[2]=positionArray[54]; //graphVertex(possibleposition[54]);
+                          }
+            else if(findpos(actuelposition,possibleposition[43])){
+                adjacentPositions[0]=positionArray[41]; //graphVertex(possibleposition[41]);
+                adjacentPositions[1]=positionArray[46]; //graphVertex(possibleposition[46]);
+                       }
+            else if(findpos(actuelposition,possibleposition[44])){
+                adjacentPositions[0]=positionArray[40]; //graphVertex(possibleposition[40]);
+                adjacentPositions[1]=positionArray[66]; //graphVertex(possibleposition[66]);
+                       }
+            else if(findpos(actuelposition,possibleposition[45])){
+                adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);
+                adjacentPositions[1]=positionArray[39]; //graphVertex(possibleposition[39]);
+                adjacentPositions[2]=positionArray[49]; //graphVertex(possibleposition[49]);
+                          }
+            else if(findpos(actuelposition,possibleposition[46])){
+                adjacentPositions[0]=positionArray[43]; //graphVertex(possibleposition[43]);
+                adjacentPositions[1]=positionArray[47]; //graphVertex(possibleposition[47]);
+                       }
+            else if(findpos(actuelposition,possibleposition[47])){
+                adjacentPositions[0]=positionArray[46]; //graphVertex(possibleposition[46]);
+                adjacentPositions[1]=positionArray[52]; //graphVertex(possibleposition[52]);
+                adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);
+                          }
+            else if(findpos(actuelposition,possibleposition[48])){
+                adjacentPositions[0]=positionArray[49]; //graphVertex(possibleposition[49]);
+                adjacentPositions[1]=positionArray[51]; //graphVertex(possibleposition[51]);
+                adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);
+                          }
+            else if(findpos(actuelposition,possibleposition[49])){
+                adjacentPositions[0]=positionArray[45]; //graphVertex(possibleposition[45]);
+                adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);
+                       }
+            else if(findpos(actuelposition,possibleposition[50])){
+                adjacentPositions[0]=positionArray[51]; //graphVertex(possibleposition[51]);
+                adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);
+                       }
+            else if(findpos(actuelposition,possibleposition[51])){
+                adjacentPositions[0]=positionArray[48]; //graphVertex(possibleposition[48]);
+                adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);
+                       }
+            else if(findpos(actuelposition,possibleposition[52])){
+                adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);
+                adjacentPositions[1]=positionArray[53]; //graphVertex(possibleposition[53]);
+                       }
+            else if(findpos(actuelposition,possibleposition[53])){
+                adjacentPositions[0]=positionArray[52]; //graphVertex(possibleposition[52]);
+                adjacentPositions[1]=positionArray[58]; //graphVertex(possibleposition[58]);
+                       }
+            else if(findpos(actuelposition,possibleposition[54])){
+                adjacentPositions[0]=positionArray[42]; //graphVertex(possibleposition[42]);
+                adjacentPositions[1]=positionArray[55]; //graphVertex(possibleposition[55]);
+                adjacentPositions[2]=positionArray[57]; //graphVertex(possibleposition[57]);
+                          }
+            else if(findpos(actuelposition,possibleposition[55])){
+                adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);
+                adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);
+                       }
+            else if(findpos(actuelposition,possibleposition[56])){
+                adjacentPositions[0]=positionArray[55]; //graphVertex(possibleposition[55]);
+                adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);
+                adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);
+                          }
+            else if(findpos(actuelposition,possibleposition[57])){
+                adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);
+                adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);
+                adjacentPositions[2]=positionArray[58]; //graphVertex(possibleposition[58]);
+                adjacentPositions[3]=positionArray[64]; //graphVertex(possibleposition[64]);
+                
+            }
+            else if(findpos(actuelposition,possibleposition[58])){
+                adjacentPositions[0]=positionArray[53]; //graphVertex(possibleposition[53]);
+                adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);
+                adjacentPositions[2]=positionArray[59]; //graphVertex(possibleposition[59]);
+                          }
+            else if(findpos(actuelposition,possibleposition[59])){
+                adjacentPositions[0]=positionArray[58]; //graphVertex(possibleposition[58]);
+                adjacentPositions[1]=positionArray[59]; //graphVertex(possibleposition[59]);
+                adjacentPositions[2]=positionArray[63]; //graphVertex(possibleposition[63]);
+                          }
+            else if(findpos(actuelposition,possibleposition[60])){
+                adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);
+                adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);
+                adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);
+                          }
+            else if(findpos(actuelposition,possibleposition[61])){
+                adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);
+                adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);
+                adjacentPositions[2]=positionArray[60]; //graphVertex(possibleposition[60]);
+                          }
+            else if(findpos(actuelposition,possibleposition[62])){
+                adjacentPositions[0]=positionArray[16]; //graphVertex(possibleposition[16]);
+                adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]);
+                       }
+            else if(findpos(actuelposition,possibleposition[63])){
+                adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);
+                adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);
+                       }
+            else if(findpos(actuelposition,possibleposition[64])){
+                adjacentPositions[0]=positionArray[57]; //graphVertex(possibleposition[57]);
+                adjacentPositions[1]=positionArray[63]; //graphVertex(possibleposition[63]);
+                adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);
+                          }
+            else if(findpos(actuelposition,possibleposition[65])){
+                adjacentPositions[0]=positionArray[56]; //graphVertex(possibleposition[56]);
+                adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);
+                       }
+            else if(findpos(actuelposition,possibleposition[66])){
+                adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);
+                adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);
+                       }
     }
 
 
 
-    
-
-
-
-
+}
 
 
Index: code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.h
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.h	(revision 12321)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.h	(revision 12322)
@@ -35,4 +35,8 @@
         bool isFleeing;
 
+        bool isAdjacentToPlayerLastPastPoint(Vector3 pacmanBrownPos, Vector3 arrayForNeighborPositions[]);
+
+        void findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]);
+
 
 	};
Index: code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.cc	(revision 12321)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.cc	(revision 12322)
@@ -16,4 +16,5 @@
         this->target_x=0;
         this->target_z=15;
+        this->setPosition(Vector3(0,10,15));
         this->lastPlayerPassedPoint=Vector3(70,10,-135);
 
@@ -66,4 +67,11 @@
         else{
 
+            std::cout<<startPatrol<<endl;
+            std::cout<<goalPatrol<<endl;
+            std::cout<<isPatrolling<<endl;
+            std::cout<<this->actuelposition<<endl;
+            std::cout<<this->passedByStart<<endl;
+            std::cout<<this->passedByGoal<<endl;
+
             while(lockmove){};
             lockmove = true;
@@ -78,18 +86,49 @@
 
             }
-            else if((this->isPatrolling==true)&&(cyanPos!=this->goalPatrol)){
+            else if/*((!findpos(cyanPos, startPatrol))&&*/(this->passedByStart==false)/*)*/{
+                //we have not even reached our startPatrol point
 
+                if(findpos(cyanPos, startPatrol)){
+                    this->passedByStart=true;
+                }
+                else{
+                nextMove(cyanPos, startPatrol);
+                }
+            }
+            else if/*((!findpos(cyanPos, goalPatrol))&&*/(this->passedByGoal==false)/*)*/{
+                //we have reached our startPatrol point, now we go to goalPoint
 
+                if(findpos(cyanPos, goalPatrol)){
+                    this->passedByGoal=true;
+                }
+                else{
+                nextMove(cyanPos, goalPatrol);
+                }
 
             }
-            else if(cyanPos==this->goalPatrol){
+            else if(!findpos(cyanPos, this->startPatrol)){
+                //we reached our goal, now we return to start
+
+                nextMove(cyanPos, startPatrol);
 
             }
-            else if(cyanPos==this->startPatrol){
+            else /*if(findpos(cyanPos, this->startPatrol))*/{
+                //we reached startPoint again. Either we change patrol
+                //or redo same patrol
 
+                int redoORNot = rand()%2;
+
+                if(redoORNot==1){
+
+                this->isPatrolling=false;
+                //we will change patrol region
+                    }
+                else {
+                this->passedByGoal=false;
+                //repeat patrol region
+                    }
             }
 
 
-            
 
 
@@ -102,5 +141,5 @@
 
 
-        int indexRand1=rand()%67;
+                int indexRand1=rand()%67;
                 while(indexRand1==44){
                     //new try if index is that of the position in the middle
@@ -122,5 +161,10 @@
               this->goalPatrol = possibleposition[indexRand2];
 
-              Vector3 nextMovement = getShortestPath(startPatrol, goalPatrol);
+              /*PatrolPosition startPatPol = PatrolPosition(startPatrol);
+              PatrolPosition goalPatrol = PatrolPosition(goalPatrol);*/
+
+              this->passedByStart=false;
+              this->passedByGoal=false;
+              this->isPatrolling=true;
 
     }
@@ -130,13 +174,11 @@
 
 	void PacmanCyan::nextMove( Vector3 cyanPosP, Vector3 playerPos){
-	
-        Vector3 nextTarget;
 
-	   nextTarget = getShortestPath(cyanPosP, playerPos);
+	   Vector3 nextTarget = getShortestPath(cyanPosP, playerPos);
 	
 	   setNewTargetGhost(nextTarget);
 	}
 
-    struct PacmanCyan::PatrolPosition{
+    /*struct PacmanCyan::PatrolPosition{
         //we need to check if PacmanCyan already passed the goal resp. start patrol point
 
@@ -151,5 +193,5 @@
         }
 
-    };
+    };*/
 
 
Index: code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.h
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.h	(revision 12321)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.h	(revision 12322)
@@ -29,4 +29,7 @@
   			struct PatrolPosition;
 
+  			bool passedByStart;
+  			bool passedByGoal;
+
 
 
Index: code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	(revision 12321)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	(revision 12322)
@@ -1311,5 +1311,5 @@
 
         if(indexForSWNE==4){
-            std::cout<<"Ryukyu"<<endl;
+            //std::cout<<"Ryukyu"<<endl;
             return pacLasVisPos;
         }
Index: code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	(revision 12321)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	(revision 12322)
@@ -16,5 +16,5 @@
         this->target_x=0;
         this->target_z=15;
-        this->lastPlayerPassedPoint=Vector3(70,10,-135);
+        this->lastPlayerPassedPoint=Vector3(0,0,0); //Vector3(70,10,-135);
           
     }
@@ -60,4 +60,12 @@
             }
         }
+        else if(this->lastPlayerPassedPoint==Vector3(0,0,0)){
+            //as long as the player has not started the game,
+            //i.e. lastPlayerPastPoint is (0,0,0), pink pacman
+            //cannot possibly move, because it needs the position
+            //of the player to move accordingly
+
+            this->ismoving=false;
+        }
         //Check on which position the ghost has arrived and set new target
          else{
@@ -67,8 +75,10 @@
             Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z);
             
+            std::cout<<this->lastPlayerPassedPoint<<endl;
+
             int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
             this->pointInFrontOfPlayer=getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
 
-
+            std::cout<<this->pointInFrontOfPlayer<<endl;
             nextMove(pinkPos, pointInFrontOfPlayer, lastPlayerPassedPoint);
 
Index: code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	(revision 12321)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	(revision 12322)
@@ -16,5 +16,5 @@
         this->target_x=0;
         this->target_z=15;
-        this->lastPlayerPassedPoint=Vector3(70,10,-135);
+        this->lastPlayerPassedPoint=Vector3(0,0,0); //Vector3(70,10,-135);
         this->isNearPlayer=false;
           
@@ -81,4 +81,12 @@
             }
             //std::cout<<"LemanExpress4"<<endl;
+        }
+        else if(this->lastPlayerPassedPoint==Vector3(0,0,0)){
+            //as long as the player has not started the game,
+            //i.e. lastPlayerPastPoint is (0,0,0), red pacman
+            //cannot possibly move, because it needs the position
+            //of the player to move accordingly
+
+            this->ismoving=false;
         }
 
