Index: code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	(revision 12323)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc	(revision 12325)
@@ -102,6 +102,12 @@
                 }
                 else{
+                    if(findpos(this->lastPlayerPassedPoint, Vector3(-215,10,-195))){
                     Vector3 nextMoveP = getShortestPath(brownPos, Vector3(-215,10,-195));
                     this->setNewTargetGhost(nextMoveP);
+                    }
+                    else{
+                    Vector3 nextMoveP = getShortestPath(brownPos, Vector3(-215,10,-195), this->lastPlayerPassedPoint);
+                    this->setNewTargetGhost(nextMoveP);
+                    }
                 }
 
@@ -123,63 +129,4 @@
 
 
-            /*if(absoluteDistance(this->lastPlayerPassedPoint, this->actuelposition)<50){
-                //no idea if 50 is large enough 
-
-                //if near player, flee
-
-                this->isFleeing=true;
-                Vector3 nextMove=getShortestPath( brownPos,Vector3(-215, 10, -195));
-                setNewTargetGhost(nextMove);
-
-            }
-
-            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)&&(findpos(brownPos,Vector3(-215,10,-195)))){
-                //if fleeing and reached flee point, go back near player
-            this->isFleeing=false;
-            Vector3 nextMove = getShortestPath(brownPos, this->lastPlayerPassedPoint);
-            setNewTargetGhost(nextMove);
-        }
-            else{
-                //if not fleeing and not near player, go near player
-                Vector3 nextMove = getShortestPath(brownPos, this->lastPlayerPassedPoint);
-            setNewTargetGhost(nextMove);
-            }
-            if(this->isFleeing){
-                std::cout<<"fleeing"<<endl;
-            }
-        }*/
-
-
-
-
-        	/*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);
-        		}
-
-        	}*/
             lockmove=false; //NEVER FORGET THIS ONE !!!
    
@@ -204,5 +151,5 @@
 
 
-        void PacmanBrown::findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]){      
+        /*void PacmanBrown::findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]){      
             //this function should put in adjacentPosition[] the neighboors of lastPlayerPastPoint
 
@@ -515,5 +462,5 @@
                 adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);
                        }
-    }
+    }*/
 
 
@@ -521,123 +468,2 @@
 }
 
-
-
-
-
-
-
-
-
-	/*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 PacmanBrown::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.x)+(diffVector.z)*(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);
-		setNewTargetGhost(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;
-
-    }*/
-
-
-
-
-
-
