[Orxonox-commit 7724] r12317 - code/branches/3DPacman_FS19/src/modules/pacman

peterf at orxonox.net peterf at orxonox.net
Sat Apr 20 18:29:44 CEST 2019


Author: peterf
Date: 2019-04-20 18:29:44 +0200 (Sat, 20 Apr 2019)
New Revision: 12317

Modified:
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.h
   code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
Log:
Red Pacman seems to work even better

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-04-20 15:22:51 UTC (rev 12316)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc	2019-04-20 16:29:44 UTC (rev 12317)
@@ -728,4 +728,438 @@
     }
 
 
+
+
+    //functions taken from PacmanPink
+
+
+
+
+
+    Vector3 PacmanGhost::diffVector (Vector3 start, Vector3 goal){
+
+        Vector3 result;
+        result.x=goal.x-start.x;
+        result.z=goal.z-start.z;
+        return result;
+    }
+
+    int PacmanGhost::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.z>0)&&(difference.z>difference.x)){ //mouve north
+
+            return 2;
+        }
+        else if((difference.x < 0)&&(difference.x > difference.z )){//move west
+
+            return 1;
+        }
+
+        else if((difference.x>0)&&(difference.x>difference.z)){ //move east
+            return 3;
+
+        }
+
+        else { //default move west Can still be changed
+
+        return 1;
+            }
+        
+        }
+
+    Vector3 PacmanGhost::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
+
+            if(findpos(pacLasVisPos,possibleposition[0])){
+                //no south neighbor 
+                listOfNeighboors[1]=possibleposition[19]; // west neighbor
+                listOfNeighboors[2]=possibleposition[17]; //north
+                listOfNeighboors[3]=possibleposition[1]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[1])){
+                listOfNeighboors[1]=possibleposition[0]; // west neighbor
+                listOfNeighboors[2]=possibleposition[2]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[2])){
+                listOfNeighboors[0]=possibleposition[1];  //south
+                listOfNeighboors[1]=possibleposition[3]; //west
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[3])){
+                listOfNeighboors[1]=possibleposition[4]; //west
+                listOfNeighboors[2]=possibleposition[5]; //north
+                listOfNeighboors[3]=possibleposition[2]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[4])){
+                listOfNeighboors[2]=possibleposition[6]; //north
+                listOfNeighboors[3]=possibleposition[3]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[5])){
+                listOfNeighboors[0]=possibleposition[3]; //south
+                listOfNeighboors[3]=possibleposition[7]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[6])){
+                listOfNeighboors[0]=possibleposition[4]; //south
+                listOfNeighboors[1]=possibleposition[26]; //west
+                listOfNeighboors[2]=possibleposition[9]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[7])){
+                listOfNeighboors[1]=possibleposition[5]; //west
+                listOfNeighboors[2]=possibleposition[8]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[8])){
+                listOfNeighboors[0]=possibleposition[7]; //south
+                listOfNeighboors[1]=possibleposition[9]; //west
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[9])){
+                listOfNeighboors[0]=possibleposition[6]; //south
+                listOfNeighboors[1]=possibleposition[38]; //west
+                listOfNeighboors[2]=possibleposition[10]; //north
+                listOfNeighboors[3]=possibleposition[8]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[10])){
+                listOfNeighboors[0]=possibleposition[9]; //south
+                listOfNeighboors[1]=possibleposition[45]; //west
+                listOfNeighboors[2]=possibleposition[11]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[11])){
+                listOfNeighboors[0]=possibleposition[10]; //south
+                listOfNeighboors[2]=possibleposition[13]; //north
+                listOfNeighboors[3]=possibleposition[12]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[12])){
+                listOfNeighboors[1]=possibleposition[11]; //west
+                listOfNeighboors[2]=possibleposition[14]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[13])){
+                listOfNeighboors[0]=possibleposition[11]; //south
+                listOfNeighboors[1]=possibleposition[61]; //west
+                listOfNeighboors[2]=possibleposition[16]; //north
+                listOfNeighboors[3]=possibleposition[14]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[14])){
+                listOfNeighboors[0]=possibleposition[12]; //south
+                listOfNeighboors[1]=possibleposition[13]; //west
+                listOfNeighboors[2]=possibleposition[15]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[15])){
+                listOfNeighboors[0]=possibleposition[14]; //south
+                listOfNeighboors[1]=possibleposition[16]; //west
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[16])){
+                listOfNeighboors[0]=possibleposition[13]; //south
+                listOfNeighboors[1]=possibleposition[62]; //west
+                listOfNeighboors[2]=possibleposition[15]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[17])){
+                listOfNeighboors[0]=possibleposition[0]; //south
+                listOfNeighboors[3]=possibleposition[25]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[18])){
+                listOfNeighboors[0]=possibleposition[19]; //south
+                listOfNeighboors[1]=possibleposition[24]; //west
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[19])){
+                listOfNeighboors[1]=possibleposition[20]; //west
+                listOfNeighboors[2]=possibleposition[18]; //north
+                listOfNeighboors[3]=possibleposition[0]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[20])){
+                listOfNeighboors[2]=possibleposition[21]; //north
+                listOfNeighboors[3]=possibleposition[19]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[21])){
+                listOfNeighboors[0]=possibleposition[20]; //south
+                listOfNeighboors[3]=possibleposition[22]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[22])){
+                listOfNeighboors[1]=possibleposition[21]; //west
+                listOfNeighboors[2]=possibleposition[31]; //north
+                listOfNeighboors[3]=possibleposition[23]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[23])){
+                listOfNeighboors[1]=possibleposition[22]; //west
+                listOfNeighboors[2]=possibleposition[30]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[24])){
+                listOfNeighboors[2]=possibleposition[29]; //north
+                listOfNeighboors[3]=possibleposition[18]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[25])){
+                listOfNeighboors[1]=possibleposition[17]; //west
+                listOfNeighboors[2]=possibleposition[26]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[26])){
+                listOfNeighboors[0]=possibleposition[25]; //south
+                listOfNeighboors[1]=possibleposition[27]; //west
+                listOfNeighboors[3]=possibleposition[6]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[27])){
+                listOfNeighboors[1]=possibleposition[28]; //west
+                listOfNeighboors[2]=possibleposition[37]; //north
+                listOfNeighboors[3]=possibleposition[26]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[28])){
+                listOfNeighboors[1]=possibleposition[29]; //west
+                listOfNeighboors[2]=possibleposition[36]; //north
+                listOfNeighboors[3]=possibleposition[27]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[29])){
+                listOfNeighboors[0]=possibleposition[24]; //south
+                listOfNeighboors[1]=possibleposition[30]; //west
+                listOfNeighboors[3]=possibleposition[28]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[30])){
+                listOfNeighboors[0]=possibleposition[23]; //south
+                listOfNeighboors[2]=possibleposition[34]; //north
+                listOfNeighboors[3]=possibleposition[29]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[31])){
+                listOfNeighboors[0]=possibleposition[22]; //south
+                listOfNeighboors[1]=possibleposition[32]; //west
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[32])){
+                listOfNeighboors[2]=possibleposition[33]; //north
+                listOfNeighboors[3]=possibleposition[31]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[33])){
+                listOfNeighboors[0]=possibleposition[32]; //south
+                listOfNeighboors[3]=possibleposition[34]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[34])){
+                listOfNeighboors[0]=possibleposition[30]; //south
+                listOfNeighboors[1]=possibleposition[33]; //west
+                listOfNeighboors[2]=possibleposition[92]; //north
+                listOfNeighboors[3]=possibleposition[35]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[35])){
+                listOfNeighboors[1]=possibleposition[34]; //west
+                listOfNeighboors[2]=possibleposition[91]; //north
+                listOfNeighboors[3]=possibleposition[36]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[36])){
+                listOfNeighboors[0]=possibleposition[28]; //south
+                listOfNeighboors[1]=possibleposition[35]; //west
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[37])){
+                listOfNeighboors[0]=possibleposition[27]; //south
+                listOfNeighboors[3]=possibleposition[38]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[38])){
+                listOfNeighboors[1]=possibleposition[37]; //west
+                listOfNeighboors[2]=possibleposition[39]; //north
+                listOfNeighboors[3]=possibleposition[9]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[39])){
+                listOfNeighboors[0]=possibleposition[38]; //south
+                listOfNeighboors[1]=possibleposition[40]; //west
+                listOfNeighboors[2]=possibleposition[45]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[40])){
+                listOfNeighboors[1]=possibleposition[41]; //west
+                //Not return in center
+                listOfNeighboors[3]=possibleposition[39]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[41])){
+                listOfNeighboors[0]=possibleposition[35]; //south
+                listOfNeighboors[2]=possibleposition[43]; //north
+                listOfNeighboors[3]=possibleposition[40]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[42])){
+                listOfNeighboors[0]=possibleposition[39]; //south
+                listOfNeighboors[2]=possibleposition[59]; //north
+                listOfNeighboors[3]=possibleposition[43]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[43])){
+                listOfNeighboors[0]=possibleposition[41]; //south
+                listOfNeighboors[1]=possibleposition[42]; //west
+                listOfNeighboors[2]=possibleposition[46]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[44])){
+                listOfNeighboors[0]=possibleposition[40]; //south
+                listOfNeighboors[2]=possibleposition[66]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[45])){
+                listOfNeighboors[0]=possibleposition[39]; //south
+                listOfNeighboors[2]=possibleposition[49]; //north
+                listOfNeighboors[3]=possibleposition[10]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[46])){
+                listOfNeighboors[0]=possibleposition[43]; //south
+                listOfNeighboors[3]=possibleposition[47]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[47])){
+                listOfNeighboors[1]=possibleposition[46]; //west
+                listOfNeighboors[2]=possibleposition[52]; //north
+                listOfNeighboors[3]=possibleposition[66]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[48])){
+                listOfNeighboors[1]=possibleposition[66]; //west
+                listOfNeighboors[2]=possibleposition[51]; //north
+                listOfNeighboors[3]=possibleposition[49]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[49])){
+                listOfNeighboors[0]=possibleposition[45]; //south
+                listOfNeighboors[1]=possibleposition[48]; //west
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[50])){
+                listOfNeighboors[1]=possibleposition[51]; //west
+                listOfNeighboors[2]=possibleposition[61]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[51])){
+                listOfNeighboors[0]=possibleposition[48]; //south
+                listOfNeighboors[3]=possibleposition[50]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[52])){
+                listOfNeighboors[0]=possibleposition[47]; //south
+                listOfNeighboors[1]=possibleposition[53]; //west
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[53])){
+                listOfNeighboors[2]=possibleposition[58]; //north
+                listOfNeighboors[3]=possibleposition[52]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[54])){
+                listOfNeighboors[0]=possibleposition[42]; //south
+                listOfNeighboors[1]=possibleposition[55]; //west
+                listOfNeighboors[2]=possibleposition[57]; //north
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[55])){
+                listOfNeighboors[2]=possibleposition[56]; //north
+                listOfNeighboors[3]=possibleposition[54]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[56])){
+                listOfNeighboors[0]=possibleposition[55]; //south
+                listOfNeighboors[2]=possibleposition[65]; //north
+                listOfNeighboors[3]=possibleposition[57]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[57])){
+                listOfNeighboors[0]=possibleposition[54]; //south
+                listOfNeighboors[1]=possibleposition[56]; //west
+                listOfNeighboors[2]=possibleposition[64]; //north
+                listOfNeighboors[3]=possibleposition[58]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[58])){
+                listOfNeighboors[0]=possibleposition[53]; //south
+                listOfNeighboors[1]=possibleposition[57]; //west
+                listOfNeighboors[3]=possibleposition[59]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[59])){
+                listOfNeighboors[1]=possibleposition[58]; //west
+                listOfNeighboors[2]=possibleposition[63]; //north
+                listOfNeighboors[3]=possibleposition[60]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[60])){
+                listOfNeighboors[1]=possibleposition[59]; //west
+                listOfNeighboors[2]=possibleposition[62]; //north
+                listOfNeighboors[3]=possibleposition[61]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[61])){
+                listOfNeighboors[0]=possibleposition[50]; //south
+                listOfNeighboors[1]=possibleposition[60]; //west
+                listOfNeighboors[3]=possibleposition[13]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[62])){
+                listOfNeighboors[0]=possibleposition[60]; //south
+                listOfNeighboors[3]=possibleposition[16]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[63])){
+                listOfNeighboors[0]=possibleposition[59]; //south
+                listOfNeighboors[1]=possibleposition[64]; //west
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[64])){
+                listOfNeighboors[0]=possibleposition[57]; //south
+                listOfNeighboors[1]=possibleposition[65]; //west
+                listOfNeighboors[3]=possibleposition[63]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[65])){
+                listOfNeighboors[0]=possibleposition[56]; //south
+                listOfNeighboors[3]=possibleposition[64]; //east
+                return listOfNeighboors[indexForSWNE];
+            }
+            else if(findpos(pacLasVisPos,possibleposition[66])){
+                //Not back in center
+                listOfNeighboors[1]=possibleposition[47]; //west
+                listOfNeighboors[3]=possibleposition[48]; //east
+                return listOfNeighboors[indexForSWNE];            
+            }
+
+        }
+
+
 }
\ No newline at end of file

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h	2019-04-20 15:22:51 UTC (rev 12316)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h	2019-04-20 16:29:44 UTC (rev 12317)
@@ -112,6 +112,14 @@
     Vector3 getShortestPath(Vector3 start, Vector3 goal);
 
 
+    //functions taken from PacmanPink
+
+
+    Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE);
+    int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos);
+    Vector3 diffVector (Vector3 start, Vector3 goal);
+
+
     };
 
 }

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	2019-04-20 15:22:51 UTC (rev 12316)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc	2019-04-20 16:29:44 UTC (rev 12317)
@@ -105,7 +105,7 @@
 
 
 
-	
+	/*
 	Vector3 diffVector (Vector3 start, Vector3 goal){
 
 		Vector3 result;
@@ -151,25 +151,9 @@
 
 		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
@@ -546,8 +530,8 @@
         		listOfNeighboors[3]=possibleposition[48]; //east
         		return listOfNeighboors[s];            
         	}
+*/
 
-
 	}
 
 	

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.h
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.h	2019-04-20 15:22:51 UTC (rev 12316)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.h	2019-04-20 16:29:44 UTC (rev 12317)
@@ -21,11 +21,11 @@
 
   			void nextMove(Vector3 playerPos, Vector3 redPos);
 
-  			int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos);
+  			//int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos);
 
-  			Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE);
+  			//Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE);
 
-  			Vector3 diffVector (Vector3 start, Vector3 goal);
+  			//Vector3 diffVector (Vector3 start, Vector3 goal);
 
 	};
 

Modified: code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
===================================================================
--- code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	2019-04-20 15:22:51 UTC (rev 12316)
+++ code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc	2019-04-20 16:29:44 UTC (rev 12317)
@@ -81,24 +81,28 @@
             Vector3 redPos=Vector3(this->target_x, 10, this->target_z);
             //nextMove(this->getPlayerPos(), redPos);
 
+            int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
 
+
             if(this->actuelposition!=lastPlayerPassedPoint){
-                //std::cout<<this->target_x<<" "<<this->target_z<<endl;
-                std::cout<<redPos<<endl;
+                
+                std::cout<<this->getPlayerPos()<<endl;
                 std::cout<<this->lastPlayerPassedPoint<<endl;
-                //getShortestPath(Vector3(-215,10,-195),Vector3(70,10,-135));
-                //getShortestPath(redPos, lastPlayerPassedPoint);
+                std::cout<<getPointInFrontOfPacman(lastPlayerPassedPoint, directionV)<<endl;
             nextMove(redPos, lastPlayerPassedPoint);
-            }/*
+            }
             else{// red pacman is at lastPlayerPassedPoint
-            nextMove(this->getPlayerPos(), redPos);
-            }*/
 
-            //setNewTargetRed(Vector3(70,10,-85));
-            //std::cout<<this->target_x<<" "<<target_z<<endl;
-            //std::cout<<"meuh"<<endl;
-            //std::cout<<this->actuelposition;
+            //int directionV = findPlayerTravDir (lastPlayerPassedPoint, this->getPlayerPos());
 
+            Vector3 pointInFrontOfPlayer = getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);
+
+            nextMove(redPos, pointInFrontOfPlayer);
+
+            //nextMove(this->getPlayerPos(), redPos);
+            }
+
+
             lockmove=false; //NEVER FORGET THIS ONE !!!!!!!
         }
         



More information about the Orxonox-commit mailing list