Changeset 12357
- Timestamp:
- May 9, 2019, 2:54:22 PM (6 years ago)
- Location:
- code/branches/3DPacman_FS19/src/modules/pacman
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.cc
r12338 r12357 16 16 this->target_x=0; 17 17 this->target_z=15; 18 this->lastPlayerPassedPoint=Vector3(0,0,0); //Vector3(70,10,-135);18 this->lastPlayerPassedPoint=Vector3(0,0,0); 19 19 20 20 } … … 79 79 80 80 this->ismoving=false; 81 std::cout<<"weie"<<endl;82 81 } 83 82 84 83 //Check on which position the ghost has arrived and set new target 85 84 else{ 86 std::cout<<"naye"<<endl;87 85 while(lockmove){}; 88 86 lockmove = true; … … 92 90 93 91 Vector3 brownPos=Vector3(this->target_x, 10, this->target_z); 94 std::cout<<brownPos<<endl;95 92 96 93 … … 98 95 if(findpos(brownPos, Vector3(-215,10,-195))){ 99 96 this->isFleeing=false; 100 //Vector3 nextMoveP = getShortestPath(brownPos, this->lastPlayerPassedPoint);101 //this->setNewTargetGhost(nextMoveP);102 97 } 103 98 else{ … … 124 119 setNewTargetGhost(nextMove); 125 120 } 126 121 127 122 } 128 std::cout<<this->isFleeing<<endl;129 123 130 124 -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanBrown.h
r12325 r12357 2 2 #define _PacmanBrown_H__ 3 3 4 5 4 #include "PacmanGhost.h" 6 //#include "getShortestPath.h"7 8 5 9 6 namespace orxonox { … … 14 11 PacmanBrown(Context* context); 15 12 16 virtual void tick(float dt) override; //!< Defines which actions the AutonomousDrone has to take in each tick.13 virtual void tick(float dt) override; //!< Defines which actions the AutonomousDrone has to take in each tick. 17 14 18 15 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; … … 37 34 bool isAdjacentToPlayerLastPastPoint(Vector3 pacmanBrownPos, Vector3 arrayForNeighborPositions[]); 38 35 39 //void findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]);40 41 42 36 }; 43 37 -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.cc
r12322 r12357 4 4 #include "core/CoreIncludes.h" 5 5 #include "BulletDynamics/Dynamics/btRigidBody.h" 6 7 8 6 9 7 namespace orxonox{ … … 39 37 40 38 SUPER(PacmanGhost, tick, dt); 41 42 39 this->actuelposition = this->getPosition(); 43 44 45 40 46 41 //Stop, if target arrived … … 51 46 52 47 //Move, if ghost hasn't arrived yet 53 if(this->ismoving){ 54 48 if(this->ismoving){ 55 49 if(!(abs(this->actuelposition.z-target_z)<0.5)) { 56 50 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)); … … 60 54 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0); 61 55 move(dt, actuelposition, velocity); 62 } 63 56 } 64 57 } 65 58 66 59 //Check on which position the ghost has arrived and set new target 67 60 else{ 68 69 std::cout<<startPatrol<<endl;70 std::cout<<goalPatrol<<endl;71 std::cout<<isPatrolling<<endl;72 std::cout<<this->actuelposition<<endl;73 std::cout<<this->passedByStart<<endl;74 std::cout<<this->passedByGoal<<endl;75 76 61 while(lockmove){}; 77 62 lockmove = true; … … 86 71 87 72 } 88 else if /*((!findpos(cyanPos, startPatrol))&&*/(this->passedByStart==false)/*)*/{73 else if(this->passedByStart==false){ 89 74 //we have not even reached our startPatrol point 90 75 … … 96 81 } 97 82 } 98 else if /*((!findpos(cyanPos, goalPatrol))&&*/(this->passedByGoal==false)/*)*/{83 else if(this->passedByGoal==false){ 99 84 //we have reached our startPatrol point, now we go to goalPoint 100 85 … … 113 98 114 99 } 115 else /*if(findpos(cyanPos, this->startPatrol))*/{100 else { 116 101 //we reached startPoint again. Either we change patrol 117 102 //or redo same patrol … … 130 115 } 131 116 132 133 134 135 117 lockmove=false; //NEVER FORGET THIS ONE !!!!!!! 136 118 } … … 139 121 140 122 void PacmanCyan::nextPatrol(){ 141 142 123 143 124 int indexRand1=rand()%67; … … 155 136 } 156 137 157 158 159 160 138 this->startPatrol = possibleposition[indexRand1]; 161 139 this->goalPatrol = possibleposition[indexRand2]; 162 163 /*PatrolPosition startPatPol = PatrolPosition(startPatrol);164 PatrolPosition goalPatrol = PatrolPosition(goalPatrol);*/165 140 166 141 this->passedByStart=false; … … 180 155 } 181 156 182 /*struct PacmanCyan::PatrolPosition{183 //we need to check if PacmanCyan already passed the goal resp. start patrol point184 185 public:186 187 Vector3 position;188 bool visitedPoint;189 190 PatrolPosition(Vector3 positionP){191 this->position=positionP;192 visitedPoint=false;193 }194 195 };*/196 197 157 198 158 } -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanCyan.h
r12322 r12357 2 2 #define _PacmanCyan_H__ 3 3 4 5 4 #include "PacmanGhost.h" 6 //#include "getShortestPath.h"7 8 5 9 6 namespace orxonox { … … 14 11 PacmanCyan(Context* context); 15 12 16 virtual void tick(float dt) override; //!< Defines which actions the AutonomousDrone has to take in each tick.13 virtual void tick(float dt) override; //!< Defines which actions the AutonomousDrone has to take in each tick. 17 14 18 15 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; … … 32 29 bool passedByGoal; 33 30 34 35 36 31 }; 37 32 -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
r12338 r12357 45 45 graphVertex *adjacentVertices[4]; //neighbooring vertices 46 46 47 //would a vector of vector storing the neighboors not be more suitable ?48 49 47 int shortestDistanceToStart; //actual shortest distance to start point 50 48 graphVertex* actuelPredecessor; //the predecessor giving the for now shortest … … 227 225 return player->getWorldPosition(); 228 226 } 229 //std::cout<<"bug ??"<<endl;227 230 228 return Vector3(0,0,0); //default, should not be used 231 229 … … 234 232 235 233 bool PacmanGhost::jeanfindpos(Vector3 one, Vector3 other){ 234 //This function is used to detect the last Vector3 position that the player crossed. 235 236 236 if((abs(one.x - other.x)<15) && (abs(one.y - other.y)<15) && (abs(one.z - other.z)<15)) return true; 237 237 return false; … … 239 239 240 240 void PacmanGhost::setNewTargetGhost(Vector3 goalToGo){ 241 //Ghosts will go to goalToGo 241 242 242 243 this->target_x = goalToGo.x; … … 262 263 graphVertex* actualVertex; //we will walk through the array with a pointer 263 264 264 //vector<graphVertex> listOfVertices;265 266 265 267 266 if(start==goal){ // basic case … … 271 270 for(int an=0; an < 67; an++){ 272 271 listOfVerticesM[an]= graphVertex(possibleposition[an]); //same position order as in other file 273 //listOfVertices.at(an) = graphVertex(possibleposition[an]);272 274 273 275 274 if(start==possibleposition[an]){ 276 275 actualVertex= &listOfVerticesM[an]; //our pointer points to the graph with position start in array 277 //cout<<an<<endl; 278 } 279 } 280 281 //graphVertex actualVertex= listOfVerticesM[an]; 276 277 } 278 } 282 279 283 280 actualVertex->alreadyVisited=true; //our start point is now visited … … 290 287 if(actualVertex->adjacentVertices[h]!=nullptr){ //check all neighboors of our current graphVertex 291 288 292 //h=2 and 3 never reached289 293 290 updateShortestDistanceToStart(*actualVertex, *actualVertex->adjacentVertices[h]); 294 291 } //we "update" the neighboors of our new visited vertex … … 296 293 } 297 294 298 if(actualVertex==nullptr){299 std::cout<<"Ornopdpde"<<endl;300 }301 302 295 actualVertex=findNextVertexToConsider(listOfVerticesM, pointToAvoidP1); 303 296 actualVertex->alreadyVisited=true; 304 //cout<<actualVertex->position<<endl;297 305 298 if(actualVertex->position!=goal){ 306 299 findNeighboorVertices(actualVertex->position, actualVertex->adjacentVertices, listOfVerticesM); … … 309 302 } 310 303 311 //cout<<"meuejeeke"<<endl; never reached312 313 304 //we should have reached our goal at this point 314 305 … … 326 317 327 318 int PacmanGhost::graphDistance(Vector3 start, Vector3 goal){ 328 //cout<<hgj++<<endl;319 329 320 Vector3 differenceVector= Vector3(abs(goal.x-start.x), 0,abs(goal.z-start.z)); 330 321 … … 361 352 shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position); 362 353 nearestNonVisitedNeighboor=vertex.adjacentVertices[i]; //warning, both sides are pointer adresses ! 363 //cout<<shortestDistance<<endl;354 364 355 } 365 356 else if(graphDistance(vertex.position, vertex.adjacentVertices[i]->position)<shortestDistance){ 366 357 shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position); 367 358 nearestNonVisitedNeighboor=vertex.adjacentVertices[i]; //warning, both sides are pointer adresses ! 368 //cout<<(hgj++)%4<<endl;359 369 360 } 370 361 } 371 362 } 372 363 vertex.currentNearestNonVisitedNeighboor = nearestNonVisitedNeighboor; //warning, both sides are pointer adresses ! 373 //cout<<hgj++<<endl;364 374 365 } 375 366 … … 422 413 ////////////////////////////////////////////////////////////////////////////////////////////// 423 414 424 //-215 -185 -135 -70 -20 0 20 70 135 185 215425 426 //-195 -135 -85 -35 15 60 105 150 195 245427 428 415 void PacmanGhost::findNeighboorVertices(Vector3 actuelposition, graphVertex* adjacentVertices[], graphVertex listOfVerticesP2[]){ 429 416 //Should put in adjacentVertices the neighboor points of actuelposition. listOfVertices is the 417 //array containing all possible positions in the map. 430 418 431 419 if(findpos(actuelposition,possibleposition[0])){ 432 // we should use listOfVerticesP2[i] instead of possibleposition[i] I think 433 // so that all neighboors are "the same" 434 adjacentVertices[0]=&listOfVerticesP2[1]; //graphVertex(possibleposition[1]); //need to do it everywhere !!! 435 adjacentVertices[1]=&listOfVerticesP2[17]; //graphVertex(possibleposition[17]); 436 adjacentVertices[2]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ? 420 421 adjacentVertices[0]=&listOfVerticesP2[1]; 422 adjacentVertices[1]=&listOfVerticesP2[17]; 423 adjacentVertices[2]=&listOfVerticesP2[19]; 437 424 } 438 425 else if(findpos(actuelposition,possibleposition[1])){ 439 adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]);440 adjacentVertices[1]=&listOfVerticesP2[2]; //graphVertex(possibleposition[2]);426 adjacentVertices[0]=&listOfVerticesP2[0]; 427 adjacentVertices[1]=&listOfVerticesP2[2]; 441 428 } 442 429 else if(findpos(actuelposition,possibleposition[2])){ 443 adjacentVertices[0]=&listOfVerticesP2[1]; //graphVertex(possibleposition[1]);444 adjacentVertices[1]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]);430 adjacentVertices[0]=&listOfVerticesP2[1]; 431 adjacentVertices[1]=&listOfVerticesP2[3]; 445 432 } 446 433 else if(findpos(actuelposition,possibleposition[3])){ 447 adjacentVertices[0]=&listOfVerticesP2[2]; //graphVertex(possibleposition[2]);448 adjacentVertices[1]=&listOfVerticesP2[4]; //graphVertex(possibleposition[4]);449 adjacentVertices[2]=&listOfVerticesP2[5]; //graphVertex(possibleposition[5]);434 adjacentVertices[0]=&listOfVerticesP2[2]; 435 adjacentVertices[1]=&listOfVerticesP2[4]; 436 adjacentVertices[2]=&listOfVerticesP2[5]; 450 437 } 451 438 else if(findpos(actuelposition,possibleposition[4])){ 452 adjacentVertices[0]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]);453 adjacentVertices[1]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]);439 adjacentVertices[0]=&listOfVerticesP2[3]; 440 adjacentVertices[1]=&listOfVerticesP2[6]; 454 441 } 455 442 else if(findpos(actuelposition,possibleposition[5])){ 456 adjacentVertices[0]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]);457 adjacentVertices[1]=&listOfVerticesP2[7]; //graphVertex(possibleposition[7]);443 adjacentVertices[0]=&listOfVerticesP2[3]; 444 adjacentVertices[1]=&listOfVerticesP2[7]; 458 445 } 459 446 else if(findpos(actuelposition,possibleposition[6])){ 460 adjacentVertices[0]=&listOfVerticesP2[4]; //graphVertex(possibleposition[4]);461 adjacentVertices[1]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);462 adjacentVertices[2]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]);447 adjacentVertices[0]=&listOfVerticesP2[4]; 448 adjacentVertices[1]=&listOfVerticesP2[9]; 449 adjacentVertices[2]=&listOfVerticesP2[26]; 463 450 } 464 451 else if(findpos(actuelposition,possibleposition[7])){ 465 adjacentVertices[0]=&listOfVerticesP2[5]; //graphVertex(possibleposition[5]);466 adjacentVertices[1]=&listOfVerticesP2[8]; //graphVertex(possibleposition[8]);452 adjacentVertices[0]=&listOfVerticesP2[5]; 453 adjacentVertices[1]=&listOfVerticesP2[8]; 467 454 } 468 455 else if(findpos(actuelposition,possibleposition[8])){ 469 adjacentVertices[0]=&listOfVerticesP2[7]; //graphVertex(possibleposition[7]);470 adjacentVertices[1]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);456 adjacentVertices[0]=&listOfVerticesP2[7]; 457 adjacentVertices[1]=&listOfVerticesP2[9]; 471 458 } 472 459 else if(findpos(actuelposition,possibleposition[9])){ 473 adjacentVertices[0]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]);474 adjacentVertices[1]=&listOfVerticesP2[8]; //graphVertex(possibleposition[8]);475 adjacentVertices[2]=&listOfVerticesP2[10]; //graphVertex(possibleposition[10]);476 adjacentVertices[3]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]);460 adjacentVertices[0]=&listOfVerticesP2[6]; 461 adjacentVertices[1]=&listOfVerticesP2[8]; 462 adjacentVertices[2]=&listOfVerticesP2[10]; 463 adjacentVertices[3]=&listOfVerticesP2[38]; 477 464 } 478 465 else if(findpos(actuelposition,possibleposition[10])){ 479 adjacentVertices[0]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);480 adjacentVertices[1]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]);481 adjacentVertices[2]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]);466 adjacentVertices[0]=&listOfVerticesP2[9]; 467 adjacentVertices[1]=&listOfVerticesP2[11]; 468 adjacentVertices[2]=&listOfVerticesP2[45]; 482 469 } 483 470 else if(findpos(actuelposition,possibleposition[11])){ 484 adjacentVertices[0]=&listOfVerticesP2[10]; //graphVertex(possibleposition[10]);485 adjacentVertices[1]=&listOfVerticesP2[12]; //graphVertex(possibleposition[12]);486 adjacentVertices[2]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);471 adjacentVertices[0]=&listOfVerticesP2[10]; 472 adjacentVertices[1]=&listOfVerticesP2[12]; 473 adjacentVertices[2]=&listOfVerticesP2[13]; 487 474 } 488 475 else if(findpos(actuelposition,possibleposition[12])){ 489 adjacentVertices[0]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]);490 adjacentVertices[1]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]);476 adjacentVertices[0]=&listOfVerticesP2[11]; 477 adjacentVertices[1]=&listOfVerticesP2[14]; 491 478 } 492 479 else if(findpos(actuelposition,possibleposition[13])){ 493 adjacentVertices[0]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]);494 adjacentVertices[1]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]);495 adjacentVertices[2]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]);496 adjacentVertices[3]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]);480 adjacentVertices[0]=&listOfVerticesP2[11]; 481 adjacentVertices[1]=&listOfVerticesP2[14]; 482 adjacentVertices[2]=&listOfVerticesP2[16]; 483 adjacentVertices[3]=&listOfVerticesP2[61]; 497 484 } 498 485 else if(findpos(actuelposition,possibleposition[14])){ 499 adjacentVertices[0]=&listOfVerticesP2[12]; //graphVertex(possibleposition[12]);500 adjacentVertices[1]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);501 adjacentVertices[2]=&listOfVerticesP2[15]; //graphVertex(possibleposition[15]);486 adjacentVertices[0]=&listOfVerticesP2[12]; 487 adjacentVertices[1]=&listOfVerticesP2[13]; 488 adjacentVertices[2]=&listOfVerticesP2[15]; 502 489 } 503 490 else if(findpos(actuelposition,possibleposition[15])){ 504 adjacentVertices[0]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]);505 adjacentVertices[1]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]);491 adjacentVertices[0]=&listOfVerticesP2[14]; 492 adjacentVertices[1]=&listOfVerticesP2[16]; 506 493 } 507 494 else if(findpos(actuelposition,possibleposition[16])){ 508 adjacentVertices[0]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);509 adjacentVertices[1]=&listOfVerticesP2[15]; //graphVertex(possibleposition[15]);510 adjacentVertices[2]=&listOfVerticesP2[62]; //graphVertex(possibleposition[62]);495 adjacentVertices[0]=&listOfVerticesP2[13]; 496 adjacentVertices[1]=&listOfVerticesP2[15]; 497 adjacentVertices[2]=&listOfVerticesP2[62]; 511 498 } 512 499 else if(findpos(actuelposition,possibleposition[17])){ 513 adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]);514 adjacentVertices[1]=&listOfVerticesP2[25]; //graphVertex(possibleposition[25]);500 adjacentVertices[0]=&listOfVerticesP2[0]; 501 adjacentVertices[1]=&listOfVerticesP2[25]; 515 502 } 516 503 else if(findpos(actuelposition,possibleposition[18])){ 517 adjacentVertices[0]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]);518 adjacentVertices[1]=&listOfVerticesP2[24]; //graphVertex(possibleposition[24]);504 adjacentVertices[0]=&listOfVerticesP2[19]; 505 adjacentVertices[1]=&listOfVerticesP2[24]; 519 506 } 520 507 else if(findpos(actuelposition,possibleposition[19])){ 521 adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]);522 adjacentVertices[1]=&listOfVerticesP2[18]; //graphVertex(possibleposition[18]);523 adjacentVertices[2]=&listOfVerticesP2[20]; //graphVertex(possibleposition[20]);508 adjacentVertices[0]=&listOfVerticesP2[0]; 509 adjacentVertices[1]=&listOfVerticesP2[18]; 510 adjacentVertices[2]=&listOfVerticesP2[20]; 524 511 } 525 512 else if(findpos(actuelposition,possibleposition[20])){ 526 adjacentVertices[0]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]);527 adjacentVertices[1]=&listOfVerticesP2[21]; //graphVertex(possibleposition[21]);513 adjacentVertices[0]=&listOfVerticesP2[19]; 514 adjacentVertices[1]=&listOfVerticesP2[21]; 528 515 } 529 516 else if(findpos(actuelposition,possibleposition[21])){ 530 adjacentVertices[0]=&listOfVerticesP2[20]; //graphVertex(possibleposition[20]);531 adjacentVertices[1]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]);517 adjacentVertices[0]=&listOfVerticesP2[20]; 518 adjacentVertices[1]=&listOfVerticesP2[22]; 532 519 } 533 520 else if(findpos(actuelposition,possibleposition[22])){ 534 adjacentVertices[0]=&listOfVerticesP2[21]; //graphVertex(possibleposition[21]);535 adjacentVertices[1]=&listOfVerticesP2[23]; //graphVertex(possibleposition[23]);536 adjacentVertices[2]=&listOfVerticesP2[31]; //graphVertex(possibleposition[31]);521 adjacentVertices[0]=&listOfVerticesP2[21]; 522 adjacentVertices[1]=&listOfVerticesP2[23]; 523 adjacentVertices[2]=&listOfVerticesP2[31]; 537 524 } 538 525 else if(findpos(actuelposition,possibleposition[23])){ 539 adjacentVertices[0]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]);540 adjacentVertices[1]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]);526 adjacentVertices[0]=&listOfVerticesP2[22]; 527 adjacentVertices[1]=&listOfVerticesP2[30]; 541 528 } 542 529 else if(findpos(actuelposition,possibleposition[24])){ 543 adjacentVertices[0]=&listOfVerticesP2[18]; //graphVertex(possibleposition[18]);544 adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]);530 adjacentVertices[0]=&listOfVerticesP2[18]; 531 adjacentVertices[1]=&listOfVerticesP2[29]; 545 532 } 546 533 else if(findpos(actuelposition,possibleposition[25])){ 547 adjacentVertices[0]=&listOfVerticesP2[17]; //graphVertex(possibleposition[17]);548 adjacentVertices[1]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]);534 adjacentVertices[0]=&listOfVerticesP2[17]; 535 adjacentVertices[1]=&listOfVerticesP2[26]; 549 536 } 550 537 else if(findpos(actuelposition,possibleposition[26])){ 551 adjacentVertices[0]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]);552 adjacentVertices[1]=&listOfVerticesP2[25]; //graphVertex(possibleposition[25]);553 adjacentVertices[2]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]);538 adjacentVertices[0]=&listOfVerticesP2[6]; 539 adjacentVertices[1]=&listOfVerticesP2[25]; 540 adjacentVertices[2]=&listOfVerticesP2[27]; 554 541 } 555 542 else if(findpos(actuelposition,possibleposition[27])){ 556 adjacentVertices[0]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]);557 adjacentVertices[1]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]);558 adjacentVertices[2]=&listOfVerticesP2[37]; //graphVertex(possibleposition[37]);543 adjacentVertices[0]=&listOfVerticesP2[26]; 544 adjacentVertices[1]=&listOfVerticesP2[28]; 545 adjacentVertices[2]=&listOfVerticesP2[37]; 559 546 } 560 547 else if(findpos(actuelposition,possibleposition[28])){ 561 adjacentVertices[0]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]);562 adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]);563 adjacentVertices[2]=&listOfVerticesP2[36]; //graphVertex(possibleposition[36]);548 adjacentVertices[0]=&listOfVerticesP2[27]; 549 adjacentVertices[1]=&listOfVerticesP2[29]; 550 adjacentVertices[2]=&listOfVerticesP2[36]; 564 551 } 565 552 else if(findpos(actuelposition,possibleposition[29])){ 566 adjacentVertices[0]=&listOfVerticesP2[24]; //graphVertex(possibleposition[24]);567 adjacentVertices[1]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]);568 adjacentVertices[2]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]);553 adjacentVertices[0]=&listOfVerticesP2[24]; 554 adjacentVertices[1]=&listOfVerticesP2[28]; 555 adjacentVertices[2]=&listOfVerticesP2[30]; 569 556 } 570 557 else if(findpos(actuelposition,possibleposition[30])){ 571 adjacentVertices[0]=&listOfVerticesP2[23]; //graphVertex(possibleposition[23]);572 adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]);573 adjacentVertices[2]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);558 adjacentVertices[0]=&listOfVerticesP2[23]; 559 adjacentVertices[1]=&listOfVerticesP2[29]; 560 adjacentVertices[2]=&listOfVerticesP2[34]; 574 561 } 575 562 else if(findpos(actuelposition,possibleposition[31])){ 576 adjacentVertices[0]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]);577 adjacentVertices[1]=&listOfVerticesP2[32]; //graphVertex(possibleposition[32]);563 adjacentVertices[0]=&listOfVerticesP2[22]; 564 adjacentVertices[1]=&listOfVerticesP2[32]; 578 565 } 579 566 else if(findpos(actuelposition,possibleposition[32])){ 580 adjacentVertices[0]=&listOfVerticesP2[31]; //graphVertex(possibleposition[31]);581 adjacentVertices[1]=&listOfVerticesP2[33]; //graphVertex(possibleposition[33]);567 adjacentVertices[0]=&listOfVerticesP2[31]; 568 adjacentVertices[1]=&listOfVerticesP2[33]; 582 569 } 583 570 else if(findpos(actuelposition,possibleposition[33])){ 584 adjacentVertices[0]=&listOfVerticesP2[32]; //graphVertex(possibleposition[32]);585 adjacentVertices[1]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);571 adjacentVertices[0]=&listOfVerticesP2[32]; 572 adjacentVertices[1]=&listOfVerticesP2[34]; 586 573 } 587 574 else if(findpos(actuelposition,possibleposition[34])){ 588 adjacentVertices[0]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]);589 adjacentVertices[1]=&listOfVerticesP2[33]; //graphVertex(possibleposition[33]);590 adjacentVertices[2]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);591 adjacentVertices[3]=&listOfVerticesP2[42]; //graphVertex(possibleposition[42]);575 adjacentVertices[0]=&listOfVerticesP2[30]; 576 adjacentVertices[1]=&listOfVerticesP2[33]; 577 adjacentVertices[2]=&listOfVerticesP2[35]; 578 adjacentVertices[3]=&listOfVerticesP2[42]; 592 579 593 580 } 594 581 else if(findpos(actuelposition,possibleposition[35])){ 595 adjacentVertices[0]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);596 adjacentVertices[1]=&listOfVerticesP2[36]; //graphVertex(possibleposition[36]);597 adjacentVertices[2]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);582 adjacentVertices[0]=&listOfVerticesP2[34]; 583 adjacentVertices[1]=&listOfVerticesP2[36]; 584 adjacentVertices[2]=&listOfVerticesP2[41]; 598 585 } 599 586 else if(findpos(actuelposition,possibleposition[36])){ 600 adjacentVertices[0]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]);601 adjacentVertices[1]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);587 adjacentVertices[0]=&listOfVerticesP2[28]; 588 adjacentVertices[1]=&listOfVerticesP2[35]; 602 589 } 603 590 else if(findpos(actuelposition,possibleposition[37])){ 604 adjacentVertices[0]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]);605 adjacentVertices[1]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]);591 adjacentVertices[0]=&listOfVerticesP2[27]; 592 adjacentVertices[1]=&listOfVerticesP2[38]; 606 593 } 607 594 else if(findpos(actuelposition,possibleposition[38])){ 608 adjacentVertices[0]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]);609 adjacentVertices[1]=&listOfVerticesP2[37]; //graphVertex(possibleposition[37]);610 adjacentVertices[2]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]);595 adjacentVertices[0]=&listOfVerticesP2[9]; 596 adjacentVertices[1]=&listOfVerticesP2[37]; 597 adjacentVertices[2]=&listOfVerticesP2[39]; 611 598 } 612 599 else if(findpos(actuelposition,possibleposition[39])){ 613 adjacentVertices[0]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]);614 adjacentVertices[1]=&listOfVerticesP2[40]; //graphVertex(possibleposition[40]);615 adjacentVertices[2]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]);600 adjacentVertices[0]=&listOfVerticesP2[38]; 601 adjacentVertices[1]=&listOfVerticesP2[40]; 602 adjacentVertices[2]=&listOfVerticesP2[45]; 616 603 } 617 604 else if(findpos(actuelposition,possibleposition[40])){ 618 adjacentVertices[0]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]);619 adjacentVertices[1]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);605 adjacentVertices[0]=&listOfVerticesP2[39]; 606 adjacentVertices[1]=&listOfVerticesP2[41]; 620 607 } 621 608 else if(findpos(actuelposition,possibleposition[41])){ 622 adjacentVertices[0]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]);623 adjacentVertices[1]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);624 adjacentVertices[2]=&listOfVerticesP2[40]; //error meuh609 adjacentVertices[0]=&listOfVerticesP2[35]; 610 adjacentVertices[1]=&listOfVerticesP2[43]; 611 adjacentVertices[2]=&listOfVerticesP2[40]; 625 612 } 626 613 else if(findpos(actuelposition,possibleposition[42])){ 627 adjacentVertices[0]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]);628 adjacentVertices[1]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);629 adjacentVertices[2]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]);614 adjacentVertices[0]=&listOfVerticesP2[34]; 615 adjacentVertices[1]=&listOfVerticesP2[43]; 616 adjacentVertices[2]=&listOfVerticesP2[54]; 630 617 } 631 618 else if(findpos(actuelposition,possibleposition[43])){ 632 adjacentVertices[0]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]);633 adjacentVertices[1]=&listOfVerticesP2[46]; //graphVertex(possibleposition[46]);634 adjacentVertices[2]=&listOfVerticesP2[42]; //error meuh619 adjacentVertices[0]=&listOfVerticesP2[41]; 620 adjacentVertices[1]=&listOfVerticesP2[46]; 621 adjacentVertices[2]=&listOfVerticesP2[42]; 635 622 } 636 623 else if(findpos(actuelposition,possibleposition[44])){ 637 adjacentVertices[0]=&listOfVerticesP2[40]; //graphVertex(possibleposition[40]);638 adjacentVertices[1]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]);624 adjacentVertices[0]=&listOfVerticesP2[40]; 625 adjacentVertices[1]=&listOfVerticesP2[66]; 639 626 } 640 627 else if(findpos(actuelposition,possibleposition[45])){ 641 adjacentVertices[0]=&listOfVerticesP2[10]; //graphVertex(possibleposition[10]);642 adjacentVertices[1]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]);643 adjacentVertices[2]=&listOfVerticesP2[49]; //graphVertex(possibleposition[49]);628 adjacentVertices[0]=&listOfVerticesP2[10]; 629 adjacentVertices[1]=&listOfVerticesP2[39]; 630 adjacentVertices[2]=&listOfVerticesP2[49]; 644 631 } 645 632 else if(findpos(actuelposition,possibleposition[46])){ 646 adjacentVertices[0]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]);647 adjacentVertices[1]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]);633 adjacentVertices[0]=&listOfVerticesP2[43]; 634 adjacentVertices[1]=&listOfVerticesP2[47]; 648 635 } 649 636 else if(findpos(actuelposition,possibleposition[47])){ 650 adjacentVertices[0]=&listOfVerticesP2[46]; //graphVertex(possibleposition[46]);651 adjacentVertices[1]=&listOfVerticesP2[52]; //graphVertex(possibleposition[52]);652 adjacentVertices[2]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]);637 adjacentVertices[0]=&listOfVerticesP2[46]; 638 adjacentVertices[1]=&listOfVerticesP2[52]; 639 adjacentVertices[2]=&listOfVerticesP2[66]; 653 640 } 654 641 else if(findpos(actuelposition,possibleposition[48])){ 655 adjacentVertices[0]=&listOfVerticesP2[49]; //graphVertex(possibleposition[49]);656 adjacentVertices[1]=&listOfVerticesP2[51]; //graphVertex(possibleposition[51]);657 adjacentVertices[2]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]);642 adjacentVertices[0]=&listOfVerticesP2[49]; 643 adjacentVertices[1]=&listOfVerticesP2[51]; 644 adjacentVertices[2]=&listOfVerticesP2[66]; 658 645 } 659 646 else if(findpos(actuelposition,possibleposition[49])){ 660 adjacentVertices[0]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]);661 adjacentVertices[1]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]);647 adjacentVertices[0]=&listOfVerticesP2[45]; 648 adjacentVertices[1]=&listOfVerticesP2[48]; 662 649 } 663 650 else if(findpos(actuelposition,possibleposition[50])){ 664 adjacentVertices[0]=&listOfVerticesP2[51]; //graphVertex(possibleposition[51]);665 adjacentVertices[1]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]);651 adjacentVertices[0]=&listOfVerticesP2[51]; 652 adjacentVertices[1]=&listOfVerticesP2[61]; 666 653 } 667 654 else if(findpos(actuelposition,possibleposition[51])){ 668 adjacentVertices[0]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]);669 adjacentVertices[1]=&listOfVerticesP2[50]; //graphVertex(possibleposition[50]);655 adjacentVertices[0]=&listOfVerticesP2[48]; 656 adjacentVertices[1]=&listOfVerticesP2[50]; 670 657 } 671 658 else if(findpos(actuelposition,possibleposition[52])){ 672 adjacentVertices[0]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]);673 adjacentVertices[1]=&listOfVerticesP2[53]; //graphVertex(possibleposition[53]);659 adjacentVertices[0]=&listOfVerticesP2[47]; 660 adjacentVertices[1]=&listOfVerticesP2[53]; 674 661 } 675 662 else if(findpos(actuelposition,possibleposition[53])){ 676 adjacentVertices[0]=&listOfVerticesP2[52]; //graphVertex(possibleposition[52]);677 adjacentVertices[1]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);663 adjacentVertices[0]=&listOfVerticesP2[52]; 664 adjacentVertices[1]=&listOfVerticesP2[58]; 678 665 } 679 666 else if(findpos(actuelposition,possibleposition[54])){ 680 adjacentVertices[0]=&listOfVerticesP2[42]; //graphVertex(possibleposition[42]);681 adjacentVertices[1]=&listOfVerticesP2[55]; //graphVertex(possibleposition[55]);682 adjacentVertices[2]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);667 adjacentVertices[0]=&listOfVerticesP2[42]; 668 adjacentVertices[1]=&listOfVerticesP2[55]; 669 adjacentVertices[2]=&listOfVerticesP2[57]; 683 670 } 684 671 else if(findpos(actuelposition,possibleposition[55])){ 685 adjacentVertices[0]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]);686 adjacentVertices[1]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]);672 adjacentVertices[0]=&listOfVerticesP2[54]; 673 adjacentVertices[1]=&listOfVerticesP2[56]; 687 674 } 688 675 else if(findpos(actuelposition,possibleposition[56])){ 689 adjacentVertices[0]=&listOfVerticesP2[55]; //graphVertex(possibleposition[55]);690 adjacentVertices[1]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);691 adjacentVertices[2]=&listOfVerticesP2[65]; //graphVertex(possibleposition[65]);676 adjacentVertices[0]=&listOfVerticesP2[55]; 677 adjacentVertices[1]=&listOfVerticesP2[57]; 678 adjacentVertices[2]=&listOfVerticesP2[65]; 692 679 } 693 680 else if(findpos(actuelposition,possibleposition[57])){ 694 adjacentVertices[0]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]);695 adjacentVertices[1]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]);696 adjacentVertices[2]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);697 adjacentVertices[3]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]);681 adjacentVertices[0]=&listOfVerticesP2[54]; 682 adjacentVertices[1]=&listOfVerticesP2[56]; 683 adjacentVertices[2]=&listOfVerticesP2[58]; 684 adjacentVertices[3]=&listOfVerticesP2[64]; 698 685 699 686 } 700 687 else if(findpos(actuelposition,possibleposition[58])){ 701 adjacentVertices[0]=&listOfVerticesP2[53]; //graphVertex(possibleposition[53]);702 adjacentVertices[1]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);703 adjacentVertices[2]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);688 adjacentVertices[0]=&listOfVerticesP2[53]; 689 adjacentVertices[1]=&listOfVerticesP2[57]; 690 adjacentVertices[2]=&listOfVerticesP2[59]; 704 691 } 705 692 else if(findpos(actuelposition,possibleposition[59])){ 706 adjacentVertices[0]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]);707 adjacentVertices[1]=&listOfVerticesP2[60]; //graphVertex(possibleposition[59]);708 adjacentVertices[2]=&listOfVerticesP2[63]; //graphVertex(possibleposition[63]);693 adjacentVertices[0]=&listOfVerticesP2[58]; 694 adjacentVertices[1]=&listOfVerticesP2[60]; 695 adjacentVertices[2]=&listOfVerticesP2[63]; 709 696 } 710 697 else if(findpos(actuelposition,possibleposition[60])){ 711 adjacentVertices[0]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);712 adjacentVertices[1]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]);713 adjacentVertices[2]=&listOfVerticesP2[62]; //graphVertex(possibleposition[62]);698 adjacentVertices[0]=&listOfVerticesP2[59]; 699 adjacentVertices[1]=&listOfVerticesP2[61]; 700 adjacentVertices[2]=&listOfVerticesP2[62]; 714 701 } 715 702 else if(findpos(actuelposition,possibleposition[61])){ 716 adjacentVertices[0]=&listOfVerticesP2[13]; //graphVertex(possibleposition[13]);717 adjacentVertices[1]=&listOfVerticesP2[50]; //graphVertex(possibleposition[50]);718 adjacentVertices[2]=&listOfVerticesP2[60]; //graphVertex(possibleposition[60]);703 adjacentVertices[0]=&listOfVerticesP2[13]; 704 adjacentVertices[1]=&listOfVerticesP2[50]; 705 adjacentVertices[2]=&listOfVerticesP2[60]; 719 706 } 720 707 else if(findpos(actuelposition,possibleposition[62])){ 721 adjacentVertices[0]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]);722 adjacentVertices[1]=&listOfVerticesP2[60]; //graphVertex(possibleposition[60]);708 adjacentVertices[0]=&listOfVerticesP2[16]; 709 adjacentVertices[1]=&listOfVerticesP2[60]; 723 710 } 724 711 else if(findpos(actuelposition,possibleposition[63])){ 725 adjacentVertices[0]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]);726 adjacentVertices[1]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]);712 adjacentVertices[0]=&listOfVerticesP2[59]; 713 adjacentVertices[1]=&listOfVerticesP2[64]; 727 714 } 728 715 else if(findpos(actuelposition,possibleposition[64])){ 729 adjacentVertices[0]=&listOfVerticesP2[57]; //graphVertex(possibleposition[57]);730 adjacentVertices[1]=&listOfVerticesP2[63]; //graphVertex(possibleposition[63]);731 adjacentVertices[2]=&listOfVerticesP2[65]; //graphVertex(possibleposition[65]);716 adjacentVertices[0]=&listOfVerticesP2[57]; 717 adjacentVertices[1]=&listOfVerticesP2[63]; 718 adjacentVertices[2]=&listOfVerticesP2[65]; 732 719 } 733 720 else if(findpos(actuelposition,possibleposition[65])){ 734 adjacentVertices[0]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]);735 adjacentVertices[1]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]);721 adjacentVertices[0]=&listOfVerticesP2[56]; 722 adjacentVertices[1]=&listOfVerticesP2[64]; 736 723 } 737 724 else if(findpos(actuelposition,possibleposition[66])){ 738 adjacentVertices[0]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]); 739 adjacentVertices[1]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]); 740 } 741 } 742 743 //functions taken from PacmanPink 744 /////////////////////// 745 746 747 725 adjacentVertices[0]=&listOfVerticesP2[47]; 726 adjacentVertices[1]=&listOfVerticesP2[48]; 727 } 728 } 748 729 749 730 750 731 Vector3 PacmanGhost::frontPosition(){ 732 //Should return the Vector3 point in front of the player. 751 733 752 734 Vector3 neighborPos[4] = {Vector3(-1,-1,-1)}; … … 777 759 } 778 760 else{ 779 //std::cout<<frontPoint<<endl;780 761 return frontPoint; 781 762 } … … 788 769 789 770 void PacmanGhost::findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]){ 790 //this function should put in adjacentPosition[] the neighboors of lastPlayerPastPoint 771 //this function should put in adjacentPositions[] the neighboors of actuelposition. 772 // positionArray[] contains all possible positions of the map. 791 773 792 774 if(findpos(actuelposition,possibleposition[0])){ 793 775 794 776 795 adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]); //need to do it everywhere !!!796 adjacentPositions[1]=positionArray[17]; //graphVertex(possibleposition[17]);797 adjacentPositions[2]=positionArray[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ?777 adjacentPositions[0]=positionArray[1]; 778 adjacentPositions[1]=positionArray[17]; 779 adjacentPositions[2]=positionArray[19]; 798 780 } 799 781 else if(findpos(actuelposition,possibleposition[1])){ 800 adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);801 adjacentPositions[1]=positionArray[2]; //graphVertex(possibleposition[2]);782 adjacentPositions[0]=positionArray[0]; 783 adjacentPositions[1]=positionArray[2]; 802 784 } 803 785 else if(findpos(actuelposition,possibleposition[2])){ 804 adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]);805 adjacentPositions[1]=positionArray[3]; //graphVertex(possibleposition[3]);786 adjacentPositions[0]=positionArray[1]; 787 adjacentPositions[1]=positionArray[3]; 806 788 } 807 789 else if(findpos(actuelposition,possibleposition[3])){ 808 adjacentPositions[0]=positionArray[2]; //graphVertex(possibleposition[2]);809 adjacentPositions[1]=positionArray[4]; //graphVertex(possibleposition[4]);810 adjacentPositions[2]=positionArray[5]; //graphVertex(possibleposition[5]);790 adjacentPositions[0]=positionArray[2]; 791 adjacentPositions[1]=positionArray[4]; 792 adjacentPositions[2]=positionArray[5]; 811 793 } 812 794 else if(findpos(actuelposition,possibleposition[4])){ 813 adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);814 adjacentPositions[1]=positionArray[6]; //graphVertex(possibleposition[6]);795 adjacentPositions[0]=positionArray[3]; 796 adjacentPositions[1]=positionArray[6]; 815 797 } 816 798 else if(findpos(actuelposition,possibleposition[5])){ 817 adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]);818 adjacentPositions[1]=positionArray[7]; //graphVertex(possibleposition[7]);799 adjacentPositions[0]=positionArray[3]; 800 adjacentPositions[1]=positionArray[7]; 819 801 } 820 802 else if(findpos(actuelposition,possibleposition[6])){ 821 adjacentPositions[0]=positionArray[4]; //graphVertex(possibleposition[4]);822 adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);823 adjacentPositions[2]=positionArray[26]; //graphVertex(possibleposition[26]);803 adjacentPositions[0]=positionArray[4]; ; 804 adjacentPositions[1]=positionArray[9]; 805 adjacentPositions[2]=positionArray[26]; 824 806 } 825 807 else if(findpos(actuelposition,possibleposition[7])){ 826 adjacentPositions[0]=positionArray[5]; //graphVertex(possibleposition[5]);827 adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);808 adjacentPositions[0]=positionArray[5]; 809 adjacentPositions[1]=positionArray[8]; 828 810 } 829 811 else if(findpos(actuelposition,possibleposition[8])){ 830 adjacentPositions[0]=positionArray[7]; //graphVertex(possibleposition[7]);831 adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]);812 adjacentPositions[0]=positionArray[7]; 813 adjacentPositions[1]=positionArray[9]; 832 814 } 833 815 else if(findpos(actuelposition,possibleposition[9])){ 834 adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);835 adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]);836 adjacentPositions[2]=positionArray[10]; //graphVertex(possibleposition[10]);837 adjacentPositions[3]=positionArray[38]; //graphVertex(possibleposition[38]);816 adjacentPositions[0]=positionArray[6]; 817 adjacentPositions[1]=positionArray[8]; 818 adjacentPositions[2]=positionArray[10]; 819 adjacentPositions[3]=positionArray[38]; 838 820 } 839 821 else if(findpos(actuelposition,possibleposition[10])){ 840 adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);841 adjacentPositions[1]=positionArray[11]; //graphVertex(possibleposition[11]);842 adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);822 adjacentPositions[0]=positionArray[9]; 823 adjacentPositions[1]=positionArray[11]; 824 adjacentPositions[2]=positionArray[45]; 843 825 } 844 826 else if(findpos(actuelposition,possibleposition[11])){ 845 adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);846 adjacentPositions[1]=positionArray[12]; //graphVertex(possibleposition[12]);847 adjacentPositions[2]=positionArray[13]; //graphVertex(possibleposition[13]);827 adjacentPositions[0]=positionArray[10]; 828 adjacentPositions[1]=positionArray[12]; 829 adjacentPositions[2]=positionArray[13]; 848 830 } 849 831 else if(findpos(actuelposition,possibleposition[12])){ 850 adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);851 adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);832 adjacentPositions[0]=positionArray[11]; 833 adjacentPositions[1]=positionArray[14]; 852 834 } 853 835 else if(findpos(actuelposition,possibleposition[13])){ 854 adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]);855 adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]);856 adjacentPositions[2]=positionArray[16]; //graphVertex(possibleposition[16]);857 adjacentPositions[3]=positionArray[61]; //graphVertex(possibleposition[61]);836 adjacentPositions[0]=positionArray[11]; 837 adjacentPositions[1]=positionArray[14]; 838 adjacentPositions[2]=positionArray[16]; 839 adjacentPositions[3]=positionArray[61]; 858 840 } 859 841 else if(findpos(actuelposition,possibleposition[14])){ 860 adjacentPositions[0]=positionArray[12]; //graphVertex(possibleposition[12]);861 adjacentPositions[1]=positionArray[13]; //graphVertex(possibleposition[13]);862 adjacentPositions[2]=positionArray[15]; //graphVertex(possibleposition[15]);842 adjacentPositions[0]=positionArray[12]; 843 adjacentPositions[1]=positionArray[13]; 844 adjacentPositions[2]=positionArray[15]; 863 845 } 864 846 else if(findpos(actuelposition,possibleposition[15])){ 865 adjacentPositions[0]=positionArray[14]; //graphVertex(possibleposition[14]);866 adjacentPositions[1]=positionArray[16]; //graphVertex(possibleposition[16]);847 adjacentPositions[0]=positionArray[14]; 848 adjacentPositions[1]=positionArray[16]; 867 849 } 868 850 else if(findpos(actuelposition,possibleposition[16])){ 869 adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);870 adjacentPositions[1]=positionArray[15]; //graphVertex(possibleposition[15]);871 adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);851 adjacentPositions[0]=positionArray[13]; 852 adjacentPositions[1]=positionArray[15]; 853 adjacentPositions[2]=positionArray[62]; 872 854 } 873 855 else if(findpos(actuelposition,possibleposition[17])){ 874 adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);875 adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);856 adjacentPositions[0]=positionArray[0]; 857 adjacentPositions[1]=positionArray[25]; 876 858 } 877 859 else if(findpos(actuelposition,possibleposition[18])){ 878 adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);879 adjacentPositions[1]=positionArray[24]; //graphVertex(possibleposition[24]);860 adjacentPositions[0]=positionArray[19]; 861 adjacentPositions[1]=positionArray[24]; 880 862 } 881 863 else if(findpos(actuelposition,possibleposition[19])){ 882 adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]);883 adjacentPositions[1]=positionArray[18]; //graphVertex(possibleposition[18]);884 adjacentPositions[2]=positionArray[20]; //graphVertex(possibleposition[20]);864 adjacentPositions[0]=positionArray[0]; 865 adjacentPositions[1]=positionArray[18]; 866 adjacentPositions[2]=positionArray[20]; 885 867 } 886 868 else if(findpos(actuelposition,possibleposition[20])){ 887 adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]);888 adjacentPositions[1]=positionArray[21]; //graphVertex(possibleposition[21]);869 adjacentPositions[0]=positionArray[19]; 870 adjacentPositions[1]=positionArray[21]; 889 871 } 890 872 else if(findpos(actuelposition,possibleposition[21])){ 891 adjacentPositions[0]=positionArray[20]; //graphVertex(possibleposition[20]);892 adjacentPositions[1]=positionArray[22]; //graphVertex(possibleposition[22]);873 adjacentPositions[0]=positionArray[20]; 874 adjacentPositions[1]=positionArray[22]; 893 875 } 894 876 else if(findpos(actuelposition,possibleposition[22])){ 895 adjacentPositions[0]=positionArray[21]; //graphVertex(possibleposition[21]);896 adjacentPositions[1]=positionArray[23]; //graphVertex(possibleposition[23]);897 adjacentPositions[2]=positionArray[31]; //graphVertex(possibleposition[31]);877 adjacentPositions[0]=positionArray[21]; 878 adjacentPositions[1]=positionArray[23]; 879 adjacentPositions[2]=positionArray[31]; 898 880 } 899 881 else if(findpos(actuelposition,possibleposition[23])){ 900 adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);901 adjacentPositions[1]=positionArray[30]; //graphVertex(possibleposition[30]);882 adjacentPositions[0]=positionArray[22]; 883 adjacentPositions[1]=positionArray[30]; 902 884 } 903 885 else if(findpos(actuelposition,possibleposition[24])){ 904 adjacentPositions[0]=positionArray[18]; //graphVertex(possibleposition[18]);905 adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);886 adjacentPositions[0]=positionArray[18]; 887 adjacentPositions[1]=positionArray[29]; 906 888 } 907 889 else if(findpos(actuelposition,possibleposition[25])){ 908 adjacentPositions[0]=positionArray[17]; //graphVertex(possibleposition[17]);909 adjacentPositions[1]=positionArray[26]; //graphVertex(possibleposition[26]);890 adjacentPositions[0]=positionArray[17]; 891 adjacentPositions[1]=positionArray[26]; 910 892 } 911 893 else if(findpos(actuelposition,possibleposition[26])){ 912 adjacentPositions[0]=positionArray[6]; //graphVertex(possibleposition[6]);913 adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]);914 adjacentPositions[2]=positionArray[27]; //graphVertex(possibleposition[27]);894 adjacentPositions[0]=positionArray[6]; 895 adjacentPositions[1]=positionArray[25]; 896 adjacentPositions[2]=positionArray[27]; 915 897 } 916 898 else if(findpos(actuelposition,possibleposition[27])){ 917 adjacentPositions[0]=positionArray[26]; //graphVertex(possibleposition[26]);918 adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);919 adjacentPositions[2]=positionArray[37]; //graphVertex(possibleposition[37]);899 adjacentPositions[0]=positionArray[26]; 900 adjacentPositions[1]=positionArray[28]; 901 adjacentPositions[2]=positionArray[37]; 920 902 } 921 903 else if(findpos(actuelposition,possibleposition[28])){ 922 adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);923 adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);924 adjacentPositions[2]=positionArray[36]; //graphVertex(possibleposition[36]);904 adjacentPositions[0]=positionArray[27]; 905 adjacentPositions[1]=positionArray[29]; 906 adjacentPositions[2]=positionArray[36]; 925 907 } 926 908 else if(findpos(actuelposition,possibleposition[29])){ 927 adjacentPositions[0]=positionArray[24]; //graphVertex(possibleposition[24]);928 adjacentPositions[1]=positionArray[28]; //graphVertex(possibleposition[28]);929 adjacentPositions[2]=positionArray[30]; //graphVertex(possibleposition[30]);909 adjacentPositions[0]=positionArray[24]; 910 adjacentPositions[1]=positionArray[28]; 911 adjacentPositions[2]=positionArray[30]; 930 912 } 931 913 else if(findpos(actuelposition,possibleposition[30])){ 932 adjacentPositions[0]=positionArray[23]; //graphVertex(possibleposition[23]);933 adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]);934 adjacentPositions[2]=positionArray[34]; //graphVertex(possibleposition[34]);914 adjacentPositions[0]=positionArray[23]; 915 adjacentPositions[1]=positionArray[29]; 916 adjacentPositions[2]=positionArray[34]; 935 917 } 936 918 else if(findpos(actuelposition,possibleposition[31])){ 937 adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]);938 adjacentPositions[1]=positionArray[32]; //graphVertex(possibleposition[32]);919 adjacentPositions[0]=positionArray[22]; 920 adjacentPositions[1]=positionArray[32]; 939 921 } 940 922 else if(findpos(actuelposition,possibleposition[32])){ 941 adjacentPositions[0]=positionArray[31]; //graphVertex(possibleposition[31]);942 adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);923 adjacentPositions[0]=positionArray[31]; 924 adjacentPositions[1]=positionArray[33]; 943 925 } 944 926 else if(findpos(actuelposition,possibleposition[33])){ 945 adjacentPositions[0]=positionArray[32]; //graphVertex(possibleposition[32]);946 adjacentPositions[1]=positionArray[34]; //graphVertex(possibleposition[34]);927 adjacentPositions[0]=positionArray[32]; 928 adjacentPositions[1]=positionArray[34]; 947 929 } 948 930 else if(findpos(actuelposition,possibleposition[34])){ 949 adjacentPositions[0]=positionArray[30]; //graphVertex(possibleposition[30]);950 adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]);951 adjacentPositions[2]=positionArray[35]; //graphVertex(possibleposition[35]);952 adjacentPositions[3]=positionArray[42]; //graphVertex(possibleposition[42]);931 adjacentPositions[0]=positionArray[30]; 932 adjacentPositions[1]=positionArray[33]; 933 adjacentPositions[2]=positionArray[35]; 934 adjacentPositions[3]=positionArray[42]; 953 935 954 936 } 955 937 else if(findpos(actuelposition,possibleposition[35])){ 956 adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);957 adjacentPositions[1]=positionArray[36]; //graphVertex(possibleposition[36]);958 adjacentPositions[2]=positionArray[41]; //graphVertex(possibleposition[41]);938 adjacentPositions[0]=positionArray[34]; 939 adjacentPositions[1]=positionArray[36]; 940 adjacentPositions[2]=positionArray[41]; 959 941 } 960 942 else if(findpos(actuelposition,possibleposition[36])){ 961 adjacentPositions[0]=positionArray[28]; //graphVertex(possibleposition[28]);962 adjacentPositions[1]=positionArray[35]; //graphVertex(possibleposition[35]);943 adjacentPositions[0]=positionArray[28]; 944 adjacentPositions[1]=positionArray[35]; 963 945 } 964 946 else if(findpos(actuelposition,possibleposition[37])){ 965 adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]);966 adjacentPositions[1]=positionArray[38]; //graphVertex(possibleposition[38]);947 adjacentPositions[0]=positionArray[27]; 948 adjacentPositions[1]=positionArray[38]; 967 949 } 968 950 else if(findpos(actuelposition,possibleposition[38])){ 969 adjacentPositions[0]=positionArray[9]; //graphVertex(possibleposition[9]);970 adjacentPositions[1]=positionArray[37]; //graphVertex(possibleposition[37]);971 adjacentPositions[2]=positionArray[39]; //graphVertex(possibleposition[39]);951 adjacentPositions[0]=positionArray[9]; 952 adjacentPositions[1]=positionArray[37]; 953 adjacentPositions[2]=positionArray[39]; 972 954 } 973 955 else if(findpos(actuelposition,possibleposition[39])){ 974 adjacentPositions[0]=positionArray[38]; //graphVertex(possibleposition[38]);975 adjacentPositions[1]=positionArray[40]; //graphVertex(possibleposition[40]);976 adjacentPositions[2]=positionArray[45]; //graphVertex(possibleposition[45]);956 adjacentPositions[0]=positionArray[38]; 957 adjacentPositions[1]=positionArray[40]; 958 adjacentPositions[2]=positionArray[45]; 977 959 } 978 960 else if(findpos(actuelposition,possibleposition[40])){ 979 adjacentPositions[0]=positionArray[39]; //graphVertex(possibleposition[39]);980 adjacentPositions[1]=positionArray[41]; //graphVertex(possibleposition[41]);961 adjacentPositions[0]=positionArray[39]; 962 adjacentPositions[1]=positionArray[41]; 981 963 } 982 964 else if(findpos(actuelposition,possibleposition[41])){ 983 adjacentPositions[0]=positionArray[35]; //graphVertex(possibleposition[35]);984 adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);985 adjacentPositions[2]=positionArray[40]; //error965 adjacentPositions[0]=positionArray[35]; 966 adjacentPositions[1]=positionArray[43]; 967 adjacentPositions[2]=positionArray[40]; 986 968 } 987 969 else if(findpos(actuelposition,possibleposition[42])){ 988 adjacentPositions[0]=positionArray[34]; //graphVertex(possibleposition[34]);989 adjacentPositions[1]=positionArray[43]; //graphVertex(possibleposition[43]);990 adjacentPositions[2]=positionArray[54]; //graphVertex(possibleposition[54]);970 adjacentPositions[0]=positionArray[34]; 971 adjacentPositions[1]=positionArray[43]; 972 adjacentPositions[2]=positionArray[54]; 991 973 } 992 974 else if(findpos(actuelposition,possibleposition[43])){ 993 adjacentPositions[0]=positionArray[41]; //graphVertex(possibleposition[41]);994 adjacentPositions[1]=positionArray[46]; //graphVertex(possibleposition[46]);995 adjacentPositions[2]=positionArray[42]; //error975 adjacentPositions[0]=positionArray[41]; 976 adjacentPositions[1]=positionArray[46]; 977 adjacentPositions[2]=positionArray[42]; 996 978 } 997 979 else if(findpos(actuelposition,possibleposition[44])){ 998 adjacentPositions[0]=positionArray[40]; //graphVertex(possibleposition[40]);999 adjacentPositions[1]=positionArray[66]; //graphVertex(possibleposition[66]);980 adjacentPositions[0]=positionArray[40]; 981 adjacentPositions[1]=positionArray[66]; 1000 982 } 1001 983 else if(findpos(actuelposition,possibleposition[45])){ 1002 adjacentPositions[0]=positionArray[10]; //graphVertex(possibleposition[10]);1003 adjacentPositions[1]=positionArray[39]; //graphVertex(possibleposition[39]);1004 adjacentPositions[2]=positionArray[49]; //graphVertex(possibleposition[49]);984 adjacentPositions[0]=positionArray[10]; 985 adjacentPositions[1]=positionArray[39]; 986 adjacentPositions[2]=positionArray[49]; 1005 987 } 1006 988 else if(findpos(actuelposition,possibleposition[46])){ 1007 adjacentPositions[0]=positionArray[43]; //graphVertex(possibleposition[43]);1008 adjacentPositions[1]=positionArray[47]; //graphVertex(possibleposition[47]);989 adjacentPositions[0]=positionArray[43]; 990 adjacentPositions[1]=positionArray[47]; 1009 991 } 1010 992 else if(findpos(actuelposition,possibleposition[47])){ 1011 adjacentPositions[0]=positionArray[46]; //graphVertex(possibleposition[46]);1012 adjacentPositions[1]=positionArray[52]; //graphVertex(possibleposition[52]);1013 adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);993 adjacentPositions[0]=positionArray[46]; 994 adjacentPositions[1]=positionArray[52]; 995 adjacentPositions[2]=positionArray[66]; 1014 996 } 1015 997 else if(findpos(actuelposition,possibleposition[48])){ 1016 adjacentPositions[0]=positionArray[49]; //graphVertex(possibleposition[49]);1017 adjacentPositions[1]=positionArray[51]; //graphVertex(possibleposition[51]);1018 adjacentPositions[2]=positionArray[66]; //graphVertex(possibleposition[66]);998 adjacentPositions[0]=positionArray[49]; 999 adjacentPositions[1]=positionArray[51]; 1000 adjacentPositions[2]=positionArray[66]; 1019 1001 } 1020 1002 else if(findpos(actuelposition,possibleposition[49])){ 1021 adjacentPositions[0]=positionArray[45]; //graphVertex(possibleposition[45]);1022 adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);1003 adjacentPositions[0]=positionArray[45]; 1004 adjacentPositions[1]=positionArray[48]; 1023 1005 } 1024 1006 else if(findpos(actuelposition,possibleposition[50])){ 1025 adjacentPositions[0]=positionArray[51]; //graphVertex(possibleposition[51]);1026 adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);1007 adjacentPositions[0]=positionArray[51]; 1008 adjacentPositions[1]=positionArray[61]; 1027 1009 } 1028 1010 else if(findpos(actuelposition,possibleposition[51])){ 1029 adjacentPositions[0]=positionArray[48]; //graphVertex(possibleposition[48]);1030 adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);1011 adjacentPositions[0]=positionArray[48]; 1012 adjacentPositions[1]=positionArray[50]; 1031 1013 } 1032 1014 else if(findpos(actuelposition,possibleposition[52])){ 1033 adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);1034 adjacentPositions[1]=positionArray[53]; //graphVertex(possibleposition[53]);1015 adjacentPositions[0]=positionArray[47]; 1016 adjacentPositions[1]=positionArray[53]; 1035 1017 } 1036 1018 else if(findpos(actuelposition,possibleposition[53])){ 1037 adjacentPositions[0]=positionArray[52]; //graphVertex(possibleposition[52]);1038 adjacentPositions[1]=positionArray[58]; //graphVertex(possibleposition[58]);1019 adjacentPositions[0]=positionArray[52]; 1020 adjacentPositions[1]=positionArray[58]; 1039 1021 } 1040 1022 else if(findpos(actuelposition,possibleposition[54])){ 1041 adjacentPositions[0]=positionArray[42]; //graphVertex(possibleposition[42]);1042 adjacentPositions[1]=positionArray[55]; //graphVertex(possibleposition[55]);1043 adjacentPositions[2]=positionArray[57]; //graphVertex(possibleposition[57]);1023 adjacentPositions[0]=positionArray[42]; 1024 adjacentPositions[1]=positionArray[55]; 1025 adjacentPositions[2]=positionArray[57]; 1044 1026 } 1045 1027 else if(findpos(actuelposition,possibleposition[55])){ 1046 adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);1047 adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);1028 adjacentPositions[0]=positionArray[54]; 1029 adjacentPositions[1]=positionArray[56]; 1048 1030 } 1049 1031 else if(findpos(actuelposition,possibleposition[56])){ 1050 adjacentPositions[0]=positionArray[55]; //graphVertex(possibleposition[55]);1051 adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);1052 adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);1032 adjacentPositions[0]=positionArray[55]; 1033 adjacentPositions[1]=positionArray[57]; 1034 adjacentPositions[2]=positionArray[65]; 1053 1035 } 1054 1036 else if(findpos(actuelposition,possibleposition[57])){ 1055 adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]);1056 adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]);1057 adjacentPositions[2]=positionArray[58]; //graphVertex(possibleposition[58]);1058 adjacentPositions[3]=positionArray[64]; //graphVertex(possibleposition[64]);1037 adjacentPositions[0]=positionArray[54]; 1038 adjacentPositions[1]=positionArray[56]; 1039 adjacentPositions[2]=positionArray[58]; 1040 adjacentPositions[3]=positionArray[64]; 1059 1041 1060 1042 } 1061 1043 else if(findpos(actuelposition,possibleposition[58])){ 1062 adjacentPositions[0]=positionArray[53]; //graphVertex(possibleposition[53]);1063 adjacentPositions[1]=positionArray[57]; //graphVertex(possibleposition[57]);1064 adjacentPositions[2]=positionArray[59]; //graphVertex(possibleposition[59]);1044 adjacentPositions[0]=positionArray[53]; 1045 adjacentPositions[1]=positionArray[57]; 1046 adjacentPositions[2]=positionArray[59]; 1065 1047 } 1066 1048 else if(findpos(actuelposition,possibleposition[59])){ 1067 adjacentPositions[0]=positionArray[58]; //graphVertex(possibleposition[58]);1068 adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]); //error 591069 adjacentPositions[2]=positionArray[63]; //graphVertex(possibleposition[63]);1049 adjacentPositions[0]=positionArray[58]; 1050 adjacentPositions[1]=positionArray[60]; 1051 adjacentPositions[2]=positionArray[63]; 1070 1052 } 1071 1053 else if(findpos(actuelposition,possibleposition[60])){ 1072 adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);1073 adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]);1074 adjacentPositions[2]=positionArray[62]; //graphVertex(possibleposition[62]);1054 adjacentPositions[0]=positionArray[59]; 1055 adjacentPositions[1]=positionArray[61]; 1056 adjacentPositions[2]=positionArray[62]; 1075 1057 } 1076 1058 else if(findpos(actuelposition,possibleposition[61])){ 1077 adjacentPositions[0]=positionArray[13]; //graphVertex(possibleposition[13]);1078 adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]);1079 adjacentPositions[2]=positionArray[60]; //graphVertex(possibleposition[60]);1059 adjacentPositions[0]=positionArray[13]; 1060 adjacentPositions[1]=positionArray[50]; 1061 adjacentPositions[2]=positionArray[60]; 1080 1062 } 1081 1063 else if(findpos(actuelposition,possibleposition[62])){ 1082 adjacentPositions[0]=positionArray[16]; //graphVertex(possibleposition[16]);1083 adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]);1064 adjacentPositions[0]=positionArray[16]; 1065 adjacentPositions[1]=positionArray[60]; 1084 1066 } 1085 1067 else if(findpos(actuelposition,possibleposition[63])){ 1086 adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]);1087 adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);1068 adjacentPositions[0]=positionArray[59]; 1069 adjacentPositions[1]=positionArray[64]; 1088 1070 } 1089 1071 else if(findpos(actuelposition,possibleposition[64])){ 1090 adjacentPositions[0]=positionArray[57]; //graphVertex(possibleposition[57]);1091 adjacentPositions[1]=positionArray[63]; //graphVertex(possibleposition[63]);1092 adjacentPositions[2]=positionArray[65]; //graphVertex(possibleposition[65]);1072 adjacentPositions[0]=positionArray[57]; 1073 adjacentPositions[1]=positionArray[63]; 1074 adjacentPositions[2]=positionArray[65]; 1093 1075 } 1094 1076 else if(findpos(actuelposition,possibleposition[65])){ 1095 adjacentPositions[0]=positionArray[56]; //graphVertex(possibleposition[56]);1096 adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]);1077 adjacentPositions[0]=positionArray[56]; 1078 adjacentPositions[1]=positionArray[64]; 1097 1079 } 1098 1080 else if(findpos(actuelposition,possibleposition[66])){ 1099 adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]);1100 adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]);1081 adjacentPositions[0]=positionArray[47]; 1082 adjacentPositions[1]=positionArray[48]; 1101 1083 } 1102 1084 } -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h
r12325 r12357 37 37 38 38 #include "Pacman.h" 39 //#include "GetShortestPathAlgorithm.h"40 39 41 40 namespace orxonox { … … 64 63 virtual void changewith(PacmanGhost* otherghost); 65 64 virtual void levelupvelo(); 66 67 //bool findpos(Vector3 one, Vector3 other); 65 68 66 virtual void changemovability(); 69 67 bool dontmove = false; … … 81 79 bool lockmove = false; 82 80 83 /*Vector3 getShortestPath(Vector3 start, Vector3 goal);84 81 85 Vector3 setPureArrayPos(Vector3 &posToSet); 86 87 */Vector3 getPlayerPos(); 82 Vector3 getPlayerPos(); 88 83 89 84 Vector3 playerPos; … … 92 87 93 88 Vector3 pointInFrontOfPlayer; 89 94 90 /* 95 96 97 //Vector3 pathAlgorithm;98 99 91 public: //HACK 100 101 92 */ 102 93 103 /*struct graphVertex;104 void findNeighboorVertices(Vector3 actuelposition, graphVertex* adjacentVertices[], graphVertex listOfVerticesP2[]);105 void updateShortestDistanceToStart(graphVertex &vertex, graphVertex &neighboor);106 void findNearestNonVisitedNeighboor (graphVertex &vertex);107 int graphDistance(Vector3 start, Vector3 goal);108 109 graphVertex* findNextVertexToConsider(graphVertex listOfVerticesP[]);110 Vector3 getShortestPath(Vector3 start, Vector3 goal);*/111 94 112 95 struct graphVertex; … … 119 102 Vector3 getShortestPath(Vector3 start, Vector3 goal, Vector3 pointToAvoidP1=Vector3(0,0,0)); 120 103 121 122 123 //functions taken from PacmanPink124 104 125 105 -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc
r12338 r12357 16 16 this->target_x=0; 17 17 this->target_z=15; 18 this->lastPlayerPassedPoint=Vector3(0,0,0); //Vector3(70,10,-135);18 this->lastPlayerPassedPoint=Vector3(0,0,0); 19 19 this->pointInFrontOfPlayer=Vector3(0,0,0); 20 20 … … 34 34 { 35 35 SUPER(PacmanGhost, tick, dt); 36 37 36 this->actuelposition = this->getPosition(); 38 //std::cout<<this->actuelposition<<endl;39 40 37 41 38 for(int u=0; u < 67; u++){//always check if player passed a point … … 45 42 } 46 43 47 this->pointInFrontOfPlayer=frontPosition(); //getPointInFrontOfPacman(lastPlayerPassedPoint, directionV); 48 44 this->pointInFrontOfPlayer=frontPosition(); 49 45 Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z); 50 46 … … 74 70 } 75 71 else if(this->pointInFrontOfPlayer==Vector3(0,0,0)){ 76 std::cout<<"arheeuuuu"<<endl;77 72 78 73 Vector3 pinkPos=Vector3(this->target_x, 10, this->target_z); 79 80 74 setNewTargetGhost(getShortestPath(pinkPos, this->lastPlayerPassedPoint)); 81 82 75 83 76 } … … 86 79 while(lockmove){}; 87 80 lockmove = true; 88 89 //this->pointInFrontOfPlayer=getPointInFrontOfPacman(lastPlayerPassedPoint, directionV);90 91 81 nextMove(pinkPos, pointInFrontOfPlayer, lastPlayerPassedPoint); 92 93 94 82 lockmove=false; 95 96 83 } 97 98 99 100 101 102 84 } 103 85 … … 108 90 Vector3 nextTarget; 109 91 110 /*std::cout<<this->actuelposition<<endl;111 std::cout<<pinkPosP<<endl;112 std::cout<<playerPos<<endl;113 std::cout<<pointToAvoidP11<<endl;114 std::cout<<this->getPlayerPos()<<endl;*/115 std::cout<<playerPos<<endl;116 std::cout<<"kok"<<endl;117 118 92 if(playerPos==pointToAvoidP11){ //SIGSEV if playerPos==pointToAvoidP11 otherwise 119 93 nextTarget = getShortestPath(pinkPosP, playerPos); 120 94 } 121 /*else if(pinkPosP==pointToAvoidP11){ 122 nextTarget=getShortestPath(pinkPosP, playerPos); 123 }*/ 124 else if((playerPos==Vector3(-70,10,-35))/*||(playerPos==Vector3(-20,10,-35))||(playerPos==Vector3(0,10,-35))*/){ 125 //nextTarget=pinkPosP; 95 else if(playerPos==Vector3(-70,10,-35)){ 96 126 97 nextTarget=getShortestPath(pinkPosP, Vector3(-70,10,-35)); 127 std::cout<<"ChaillyVillage"<<endl;98 128 99 } 129 /*else if((playerPos==Vector3(-70,10,-35))&&(pinkPosP==Vector3(-70,10,60))/*||(playerPos==Vector3(-20,10,-35))||(playerPos==Vector3(0,10,-35))){ 130 //nextTarget=pinkPosP; 131 nextTarget=getShortestPath(pinkPosP, Vector3(-70,10,-35)); 132 std::cout<<"ChaillyVillage"<<endl; 133 }*/ 134 else{ 135 //bugs here 136 std::cout<<pinkPosP<<endl; 100 else{ 101 137 102 nextTarget = getShortestPath(pinkPosP, playerPos, pointToAvoidP11); 138 103 } 139 std::cout<<nextTarget<<endl;104 140 105 setNewTargetGhost(nextTarget); 141 106 } -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.h
r12319 r12357 4 4 5 5 #include "PacmanGhost.h" 6 //#include "getShortestPath.h"7 6 8 7 … … 18 17 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 19 18 20 //void setNewTargetPink(Vector3 goalToGo);21 22 //void nextMove(Vector3 playerPos, Vector3 redPos);23 24 //int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos);25 26 //Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE);27 28 //Vector3 diffVector (Vector3 start, Vector3 goal);29 30 19 Vector3 pinkPos; 31 20 -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanRandom.h
r12304 r12357 7 7 8 8 class _OrxonoxExport PacmanRandom : public PacmanGhost{ 9 //This class is not used anymore in the game, given that all 4 Ghosts now have 10 //their own behavior. But it could maybe still be useful. 9 11 10 12 public: -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.cc
r12338 r12357 1 1 #include "PacmanRed.h" 2 //#include "Pacman.h"3 2 4 3 #include "core/CoreIncludes.h" … … 16 15 this->target_x=0; 17 16 this->target_z=15; 18 this->lastPlayerPassedPoint=Vector3(0,0,0); //Vector3(70,10,-135);17 this->lastPlayerPassedPoint=Vector3(0,0,0); 19 18 this->isNearPlayer=false; 20 19 … … 31 30 } 32 31 33 /*void PacmanRed::setPlayerPos(Vector3 _playerPos)34 {35 this->playerPos = _playerPos;36 }*/37 38 39 32 void PacmanRed::tick(float dt) 40 33 { 41 //std::cout<<"LemanExpress5"<<endl;42 34 SUPER(PacmanGhost, tick, dt); 43 35 … … 45 37 46 38 for(int u=0; u < 67; u++){//always check if player passed a point 47 //if(possibleposition[u]!=Vector3(0,10,15)){39 48 40 if(jeanfindpos(this->getPlayerPos(), possibleposition[u])){ 49 //if(!findpos(possibleposition[u],Vector3(0,10,15))){41 50 42 this->lastPlayerPassedPoint=possibleposition[u]; 51 } 52 //} 53 //} 43 } 54 44 } 55 56 std::cout<<this->lastPlayerPassedPoint<<endl;57 std::cout<<this->pointInFrontOfPlayer<<endl;58 59 60 45 61 46 //Stop, if target arrived 62 47 if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){ 63 //std::cout<<"LemanExpress1"<<endl;48 64 49 this->ismoving = false; 65 50 } … … 67 52 //Move, if ghost hasn't arrived yet 68 53 if(this->ismoving){ 69 //std::cout<<"LemanExpress2"<<endl;54 70 55 if(!(abs(this->actuelposition.z-target_z)<0.5)) { 71 56 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)); … … 76 61 move(dt, actuelposition, velocity); 77 62 } 78 //std::cout<<"LemanExpress4"<<endl;63 79 64 } 80 65 else if(this->lastPlayerPassedPoint==Vector3(0,0,0)){ … … 89 74 //Check on which position the ghost has arrived and set new target 90 75 else{ 91 std::cout<<"LemanExpress3"<<endl;92 76 93 77 while(lockmove){}; … … 98 82 99 83 Vector3 redPos=Vector3(this->target_x, 10, this->target_z); 100 //nextMove(this->getPlayerPos(), redPos); 101 102 this->pointInFrontOfPlayer=frontPosition(); //getPointInFrontOfPacman(lastPlayerPassedPoint, directionV); 103 84 this->pointInFrontOfPlayer=frontPosition(); 104 85 105 86 if(!findpos(this->actuelposition, lastPlayerPassedPoint)){ 106 87 107 /*std::cout<<this->getPlayerPos()<<endl;108 std::cout<<this->lastPlayerPassedPoint<<endl;109 std::cout<<this->pointInFrontOfPlayer<<endl;110 std::cout<<this->actuelposition<<endl;*/111 88 nextMove(redPos, lastPlayerPassedPoint); 112 std::cout<<"hiuddi"<<endl;113 89 } 114 90 else if(findpos(this->actuelposition, lastPlayerPassedPoint)){// red pacman is at lastPlayerPassedPoint 115 91 116 /*std::cout<<"dhdidjop"<<endl; 117 std::cout<<this->getPlayerPos()<<endl; 118 std::cout<<this->lastPlayerPassedPoint<<endl; 119 std::cout<<this->pointInFrontOfPlayer<<endl; 120 std::cout<<this->actuelposition<<endl;*/ 121 122 //if(!findpos(pointInFrontOfPlayer, Vector3(0,10,15))){ 123 nextMove(lastPlayerPassedPoint, pointInFrontOfPlayer); 124 //} 125 std::cout<<"ogslodm"<<endl; 92 nextMove(lastPlayerPassedPoint, pointInFrontOfPlayer); 126 93 } 127 128 94 129 95 lockmove=false; //NEVER FORGET THIS ONE !!!!!!! -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanRed.h
r12319 r12357 4 4 5 5 #include "PacmanGhost.h" 6 //#include "getShortestPath.h"7 6 8 7
Note: See TracChangeset
for help on using the changeset viewer.