Changeset 12304 for code/branches/3DPacman_FS19/src/modules
- Timestamp:
- Apr 18, 2019, 1:26:10 PM (6 years ago)
- Location:
- code/branches/3DPacman_FS19/src/modules/pacman
- Files:
-
- 7 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/3DPacman_FS19/src/modules/pacman/CMakeLists.txt
r12303 r12304 6 6 PacmanPointAfraid.cc 7 7 PacmanHUDinfo.cc 8 PacmanRandom.cc 9 PacmanRed.cc 8 10 getShortestPath.cc 9 PacmanRandom.cc10 11 ) 11 12 -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.cc
r12303 r12304 34 34 namespace orxonox 35 35 { 36 37 //Check if there is a collision 38 bool findpos(Vector3 one, Vector3 other){ 39 if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true; 40 return false; 41 } 42 43 //All positions in the map, see documentation 44 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 45 Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9 46 Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-14 47 Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-19 48 Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-24 49 Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-29 50 Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-34 51 Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-39 52 Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-44 53 Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-49 54 Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-54 55 Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-59 56 Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-64 57 Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-66 58 36 59 RegisterClass(PacmanGhost); 37 60 … … 47 70 48 71 this->velocity = Vector3(0, 0, 0); 72 49 73 this->setCollisionType(CollisionType::Dynamic); 50 74 … … 72 96 Method for creating a ghost through XML. 73 97 */ 74 void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode)98 void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode) 75 99 { 76 100 SUPER(PacmanGhost, XMLPort, xmlelement, mode); 77 78 }79 80 81 /* //All positions in the map, see documentation82 Vector3 possibleposition[] = {Vector3(20,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195), //0-483 Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-984 Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-1485 Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-1986 Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-2487 Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-2988 Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-3489 Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-3990 Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-4491 Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-4992 Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-5493 Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-5994 Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-6495 Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-66*/96 97 /**98 @brief99 Defines which actions the ghost has to take in each tick.100 @param dt101 The length of the tick.102 */103 void PacmanGhost::tick(float dt)104 {105 SUPER(PacmanGhost, tick, dt);106 107 this->actuelposition = this->getPosition();108 109 //Stop, if target arrived110 if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){111 this->ismoving = false;112 }113 114 //Move, if ghost hasn't arrived yet115 if(this->ismoving){116 if(!(abs(this->actuelposition.z-target_z)<0.5)) {117 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));118 move(dt, actuelposition, velocity);119 }120 if(!(abs(this->actuelposition.x-target_x)<0.5)){121 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);122 move(dt, actuelposition, velocity);123 }124 }125 126 }127 128 129 //Random choice of new target (not used in game, but useful)130 void PacmanGhost::setnewTarget(int firstdec){131 132 decision = rand()%1;133 switch(decision){134 case 0:135 this->target_x = possibleposition[firstdec].x;136 this->target_z = possibleposition[firstdec].z;137 this->ismoving = true;138 break;139 }140 101 } 141 102 … … 164 125 165 126 //Rotate ghost in the direction of movement 166 if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1)) 127 if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1)){ 167 128 if(velocity.x<0){ 168 129 this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0))); … … 171 132 this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0))); 172 133 } 173 if((abs(abs(velocity.z)-1)<0.1) && (abs(velocity.x-0)<0.1)) 134 } 135 if((abs(abs(velocity.z)-1)<0.1) && (abs(velocity.x-0)<0.1)){ 174 136 if(velocity.z<0){ 175 137 this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0))); … … 178 140 this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0))); 179 141 } 142 } 180 143 181 144 } 182 }183 184 //Check if there is a collision185 bool PacmanGhost::findpos(Vector3 one, Vector3 other){186 if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true;187 return false;188 145 } 189 146 … … 213 170 speed ++; 214 171 } 172 173 Vector3 PacmanGhost::setPureArrayPos(Vector3 &posToSet){ 174 //given that the position of a pacman is generally not "neat", 175 //we need to set it to the nearest point on the map 176 // if the pacman is not moving anymore, i.e. has reached a point 177 int i=0; 178 while(!(findpos(possibleposition[i], posToSet))){ 179 i++; 180 } 181 return possibleposition[i]; 182 } 183 184 215 185 } -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanGhost.h
r12303 r12304 38 38 namespace orxonox { 39 39 40 extern Vector3 possibleposition[67]; 41 42 extern bool findpos(Vector3 one, Vector3 other); 43 44 45 struct graphVertex; 46 void findNeighboorVertices(Vector3 actuelposition, graphVertex adjacentVertices[]); 47 void updateShortestDistanceToStart(graphVertex &vertex, graphVertex &neighboor); 48 graphVertex findNextVertexToConsider(graphVertex[]); 49 50 extern graphVertex listOfVertices[]; 51 52 40 53 class _OrxonoxExport PacmanGhost : public ControllableEntity 41 54 { … … 44 57 virtual ~PacmanGhost(); 45 58 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating an AutonomousDrone through XML.47 virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating an AutonomousDrone through XML. 60 //virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick. 48 61 49 v oid move(float dt, Vector3 actuelposition, Vector3 velocity);62 virtual void move(float dt, Vector3 actuelposition, Vector3 velocity); 50 63 51 v oid resetGhost();64 virtual void resetGhost(); 52 65 53 v oid changewith(PacmanGhost* otherghost);54 v oid levelupvelo();66 virtual void changewith(PacmanGhost* otherghost); 67 virtual void levelupvelo(); 55 68 56 bool findpos(Vector3 one, Vector3 other);57 v oid changemovability();69 //bool findpos(Vector3 one, Vector3 other); 70 virtual void changemovability(); 58 71 bool dontmove = false; 59 72 60 73 61 74 int decision = 0; 62 75 Vector3 resetposition = Vector3(0,10,15); … … 70 83 bool lockmove = false; 71 84 72 //All positions in the map, see documentation 73 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 74 Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9 75 Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-14 76 Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-19 77 Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-24 78 Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-29 79 Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-34 80 Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-39 81 Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-44 82 Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-49 83 Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-54 84 Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-59 85 Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-64 86 Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-66 85 Vector3 getShortestPath(Vector3 start, Vector3 goal); 87 86 88 private: 89 void setnewTarget(int firstdec); 90 void setnewTarget(int firstdec, int seconddec); 91 void setnewTarget(int firstdec, int seconddec, int thirddec); 92 void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec); 87 Vector3 setPureArrayPos(Vector3 &posToSet); 88 89 private: 93 90 }; 94 91 -
code/branches/3DPacman_FS19/src/modules/pacman/PacmanRandom.cc
r12303 r12304 1 2 #include "PacmanGhost.h" 3 4 5 namespace orxonox{ 6 class PacmanRandom : public PacmanGhost { 7 8 public: 9 10 /* int decision=0; 11 int target_x = 0; 12 int target_z = 0; 13 bool ismoving = false; 14 bool lockmove = false;*/ 15 16 17 //Random choice of new target (not used in game, but useful) 18 void setnewTarget(int firstdec){ 19 //setNewTarget in PacmanGhost seems to be private so we need it here too 20 21 decision = rand()%1; 1 #include "PacmanRandom.h" 2 3 #include "core/CoreIncludes.h" 4 #include "BulletDynamics/Dynamics/btRigidBody.h" 5 6 7 8 9 namespace orxonox { 10 11 12 RegisterClass(PacmanRandom); 13 14 15 16 PacmanRandom::PacmanRandom(Context* context) : PacmanGhost(context){ 17 18 RegisterObject(PacmanRandom); 19 20 21 } 22 23 /** 24 @brief 25 Method for creating a ghost through XML. 26 */ 27 void PacmanRandom::XMLPort(Element& xmlelement, XMLPort::Mode mode) 28 { 29 SUPER(PacmanRandom, XMLPort, xmlelement, mode); 30 } 31 32 void PacmanRandom::tick(float dt) 33 { 34 SUPER(PacmanGhost, tick, dt); 35 36 this->actuelposition = this->getPosition(); 37 38 //Stop, if target arrived 39 if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){ 40 this->ismoving = false; 41 } 42 43 //Move, if ghost hasn't arrived yet 44 if(this->ismoving){ 45 if(!(abs(this->actuelposition.z-target_z)<0.5)) { 46 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)); 47 move(dt, actuelposition, velocity); 48 } 49 if(!(abs(this->actuelposition.x-target_x)<0.5)){ 50 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0); 51 move(dt, actuelposition, velocity); 52 } 53 } 54 //Check on which position the ghost has arrived and set new target 55 else{ 56 while(lockmove){}; 57 lockmove = true; 58 59 if(findpos(actuelposition,possibleposition[0])){ 60 setnewTarget(1,17,19); 61 } 62 else if(findpos(actuelposition,possibleposition[1])){ 63 setnewTarget(0,2); 64 } 65 else if(findpos(actuelposition,possibleposition[2])){ 66 setnewTarget(1,3); 67 } 68 else if(findpos(actuelposition,possibleposition[3])){ 69 setnewTarget(2,4,5); 70 } 71 else if(findpos(actuelposition,possibleposition[4])){ 72 setnewTarget(3,6); 73 } 74 else if(findpos(actuelposition,possibleposition[5])){ 75 setnewTarget(3,7); 76 } 77 else if(findpos(actuelposition,possibleposition[6])){ 78 setnewTarget(4,9,26); 79 } 80 else if(findpos(actuelposition,possibleposition[7])){ 81 setnewTarget(5,8); 82 } 83 else if(findpos(actuelposition,possibleposition[8])){ 84 setnewTarget(7,9); 85 } 86 else if(findpos(actuelposition,possibleposition[9])){ 87 setnewTarget(6,8,10,38); 88 } 89 else if(findpos(actuelposition,possibleposition[10])){ 90 setnewTarget(9,11,45); 91 } 92 else if(findpos(actuelposition,possibleposition[11])){ 93 setnewTarget(10,12,13); 94 } 95 else if(findpos(actuelposition,possibleposition[12])){ 96 setnewTarget(11,14); 97 } 98 else if(findpos(actuelposition,possibleposition[13])){ 99 setnewTarget(11,14,16,61); 100 } 101 else if(findpos(actuelposition,possibleposition[14])){ 102 setnewTarget(12,13,15); 103 } 104 else if(findpos(actuelposition,possibleposition[15])){ 105 setnewTarget(14,16); 106 } 107 else if(findpos(actuelposition,possibleposition[16])){ 108 setnewTarget(13,15,62); 109 } 110 else if(findpos(actuelposition,possibleposition[17])){ 111 setnewTarget(0,25); 112 } 113 else if(findpos(actuelposition,possibleposition[18])){ 114 setnewTarget(19,24); 115 } 116 else if(findpos(actuelposition,possibleposition[19])){ 117 setnewTarget(0,18,20); 118 } 119 else if(findpos(actuelposition,possibleposition[20])){ 120 setnewTarget(19,21); 121 } 122 else if(findpos(actuelposition,possibleposition[21])){ 123 setnewTarget(20,22); 124 } 125 else if(findpos(actuelposition,possibleposition[22])){ 126 setnewTarget(21,23,31); 127 } 128 else if(findpos(actuelposition,possibleposition[23])){ 129 setnewTarget(22,30); 130 } 131 else if(findpos(actuelposition,possibleposition[24])){ 132 setnewTarget(18,29); 133 } 134 else if(findpos(actuelposition,possibleposition[25])){ 135 setnewTarget(17,26); 136 } 137 else if(findpos(actuelposition,possibleposition[26])){ 138 setnewTarget(6,25,27); 139 } 140 else if(findpos(actuelposition,possibleposition[27])){ 141 setnewTarget(26,28,37); 142 } 143 else if(findpos(actuelposition,possibleposition[28])){ 144 setnewTarget(27,29,36); 145 } 146 else if(findpos(actuelposition,possibleposition[29])){ 147 setnewTarget(24,28,30); 148 } 149 else if(findpos(actuelposition,possibleposition[30])){ 150 setnewTarget(23,29,34); 151 } 152 else if(findpos(actuelposition,possibleposition[31])){ 153 setnewTarget(22,32); 154 } 155 else if(findpos(actuelposition,possibleposition[32])){ 156 setnewTarget(31,33); 157 } 158 else if(findpos(actuelposition,possibleposition[33])){ 159 setnewTarget(32,34); 160 } 161 else if(findpos(actuelposition,possibleposition[34])){ 162 setnewTarget(30,33,35,42); 163 } 164 else if(findpos(actuelposition,possibleposition[35])){ 165 setnewTarget(34,36,41); 166 } 167 else if(findpos(actuelposition,possibleposition[36])){ 168 setnewTarget(28,35); 169 } 170 else if(findpos(actuelposition,possibleposition[37])){ 171 setnewTarget(27,38); 172 } 173 else if(findpos(actuelposition,possibleposition[38])){ 174 setnewTarget(9,37,39); 175 } 176 else if(findpos(actuelposition,possibleposition[39])){ 177 setnewTarget(38,40,45); 178 } 179 else if(findpos(actuelposition,possibleposition[40])){ 180 setnewTarget(39,41); //Shouldn't be able to return in center 181 } 182 else if(findpos(actuelposition,possibleposition[41])){ 183 setnewTarget(35,43); 184 } 185 else if(findpos(actuelposition,possibleposition[42])){ 186 setnewTarget(34,43,54); 187 } 188 else if(findpos(actuelposition,possibleposition[43])){ 189 setnewTarget(41,46); 190 } 191 else if(findpos(actuelposition,possibleposition[44])){ 192 setnewTarget(40,66); 193 } 194 else if(findpos(actuelposition,possibleposition[45])){ 195 setnewTarget(10,39,49); 196 } 197 else if(findpos(actuelposition,possibleposition[46])){ 198 setnewTarget(43,47); 199 } 200 else if(findpos(actuelposition,possibleposition[47])){ 201 setnewTarget(46,52,66); 202 } 203 else if(findpos(actuelposition,possibleposition[48])){ 204 setnewTarget(49,51,66); 205 } 206 else if(findpos(actuelposition,possibleposition[49])){ 207 setnewTarget(45,48); 208 } 209 else if(findpos(actuelposition,possibleposition[50])){ 210 setnewTarget(51,61); 211 } 212 else if(findpos(actuelposition,possibleposition[51])){ 213 setnewTarget(48,50); 214 } 215 else if(findpos(actuelposition,possibleposition[52])){ 216 setnewTarget(47,53); 217 } 218 else if(findpos(actuelposition,possibleposition[53])){ 219 setnewTarget(52,58); 220 } 221 else if(findpos(actuelposition,possibleposition[54])){ 222 setnewTarget(42,55,57); 223 } 224 else if(findpos(actuelposition,possibleposition[55])){ 225 setnewTarget(54,56); 226 } 227 else if(findpos(actuelposition,possibleposition[56])){ 228 setnewTarget(55,57,65); 229 } 230 else if(findpos(actuelposition,possibleposition[57])){ 231 setnewTarget(54,56,58,64); 232 } 233 else if(findpos(actuelposition,possibleposition[58])){ 234 setnewTarget(53,57,59); 235 } 236 else if(findpos(actuelposition,possibleposition[59])){ 237 setnewTarget(58,59,63); 238 } 239 else if(findpos(actuelposition,possibleposition[60])){ 240 setnewTarget(59,61,62); 241 } 242 else if(findpos(actuelposition,possibleposition[61])){ 243 setnewTarget(13,50,60); 244 } 245 else if(findpos(actuelposition,possibleposition[62])){ 246 setnewTarget(16,60); 247 } 248 else if(findpos(actuelposition,possibleposition[63])){ 249 setnewTarget(59,64); 250 } 251 else if(findpos(actuelposition,possibleposition[64])){ 252 setnewTarget(57,63,65); 253 } 254 else if(findpos(actuelposition,possibleposition[65])){ 255 setnewTarget(56,64); 256 } 257 else if(findpos(actuelposition,possibleposition[66])){ 258 setnewTarget(47,48); 259 } 260 261 else{ 262 this->resetGhost(); //Shouldn't happen... 263 } //End of Position table 264 lockmove = false; 265 } 266 267 } 268 269 void PacmanRandom::setnewTarget(int firstdec){ 270 271 decision = rand()%1; 22 272 switch(decision){ 23 273 case 0: … … 26 276 this->ismoving = true; 27 277 break; 28 } 29 } 30 278 } 279 } 31 280 32 281 //Random choice of new target 33 void setnewTarget(int firstdec, int seconddec){34 282 void PacmanRandom::setnewTarget(int firstdec, int seconddec){ 283 decision = rand()%2; 35 284 switch(decision){ 36 285 case 0: … … 49 298 50 299 //Random choice of new target 51 void setnewTarget(int firstdec, int seconddec, int thirddec){52 53 300 void PacmanRandom::setnewTarget(int firstdec, int seconddec, int thirddec){ 301 302 decision = rand()%3; 54 303 switch(decision){ 55 304 case 0: … … 68 317 this->ismoving = true; 69 318 break; 70 319 } 71 320 72 321 } 73 322 74 323 //Random choice of new target 75 void setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec){76 77 324 void PacmanRandom::setnewTarget(int firstdec, int seconddec, int thirddec, int fourthdec){ 325 326 decision = rand()%4; 78 327 switch(decision){ 79 328 case 0: … … 93 342 break; 94 343 case 3: 95 344 this->target_x = possibleposition[fourthdec].x; 96 345 this->target_z = possibleposition[fourthdec].z; 97 346 this->ismoving = true; 98 347 break; 99 348 } 100 349 101 } 102 103 void tick(float dt){ 104 105 PacmanGhost::tick(dt); 106 107 108 if(!(this->ismoving)){ 109 110 while(lockmove){}; 111 lockmove = true; 112 113 if(findpos(actuelposition,possibleposition[0])){ 114 setnewTarget(1,17,19); 115 } 116 else if(findpos(actuelposition,possibleposition[1])){ 117 setnewTarget(0,2); 118 } 119 else if(findpos(actuelposition,possibleposition[2])){ 120 setnewTarget(1,3); 121 } 122 else if(findpos(actuelposition,possibleposition[3])){ 123 setnewTarget(2,4,5); 124 } 125 else if(findpos(actuelposition,possibleposition[4])){ 126 setnewTarget(3,6); 127 } 128 else if(findpos(actuelposition,possibleposition[5])){ 129 setnewTarget(3,7); 130 } 131 else if(findpos(actuelposition,possibleposition[6])){ 132 setnewTarget(4,9,26); 133 } 134 else if(findpos(actuelposition,possibleposition[7])){ 135 setnewTarget(5,8); 136 } 137 else if(findpos(actuelposition,possibleposition[8])){ 138 setnewTarget(7,9); 139 } 140 else if(findpos(actuelposition,possibleposition[9])){ 141 setnewTarget(6,8,10,38); 142 } 143 else if(findpos(actuelposition,possibleposition[10])){ 144 setnewTarget(9,11,45); 145 } 146 else if(findpos(actuelposition,possibleposition[11])){ 147 setnewTarget(10,12,13); 148 } 149 else if(findpos(actuelposition,possibleposition[12])){ 150 setnewTarget(11,14); 151 } 152 else if(findpos(actuelposition,possibleposition[13])){ 153 setnewTarget(11,14,16,61); 154 } 155 else if(findpos(actuelposition,possibleposition[14])){ 156 setnewTarget(12,13,15); 157 } 158 else if(findpos(actuelposition,possibleposition[15])){ 159 setnewTarget(14,16); 160 } 161 else if(findpos(actuelposition,possibleposition[16])){ 162 setnewTarget(13,15,62); 163 } 164 else if(findpos(actuelposition,possibleposition[17])){ 165 setnewTarget(0,25); 166 } 167 else if(findpos(actuelposition,possibleposition[18])){ 168 setnewTarget(19,24); 169 } 170 else if(findpos(actuelposition,possibleposition[19])){ 171 setnewTarget(0,18,20); 172 } 173 else if(findpos(actuelposition,possibleposition[20])){ 174 setnewTarget(19,21); 175 } 176 else if(findpos(actuelposition,possibleposition[21])){ 177 setnewTarget(20,22); 178 } 179 else if(findpos(actuelposition,possibleposition[22])){ 180 setnewTarget(21,23,31); 181 } 182 else if(findpos(actuelposition,possibleposition[23])){ 183 setnewTarget(22,30); 184 } 185 else if(findpos(actuelposition,possibleposition[24])){ 186 setnewTarget(18,29); 187 } 188 else if(findpos(actuelposition,possibleposition[25])){ 189 setnewTarget(17,26); 190 } 191 else if(findpos(actuelposition,possibleposition[26])){ 192 setnewTarget(6,25,27); 193 } 194 else if(findpos(actuelposition,possibleposition[27])){ 195 setnewTarget(26,28,37); 196 } 197 else if(findpos(actuelposition,possibleposition[28])){ 198 setnewTarget(27,29,36); 199 } 200 else if(findpos(actuelposition,possibleposition[29])){ 201 setnewTarget(24,28,30); 202 } 203 else if(findpos(actuelposition,possibleposition[30])){ 204 setnewTarget(23,29,34); 205 } 206 else if(findpos(actuelposition,possibleposition[31])){ 207 setnewTarget(22,32); 208 } 209 else if(findpos(actuelposition,possibleposition[32])){ 210 setnewTarget(31,33); 211 } 212 else if(findpos(actuelposition,possibleposition[33])){ 213 setnewTarget(32,34); 214 } 215 else if(findpos(actuelposition,possibleposition[34])){ 216 setnewTarget(30,33,35,42); 217 } 218 else if(findpos(actuelposition,possibleposition[35])){ 219 setnewTarget(34,36,41); 220 } 221 else if(findpos(actuelposition,possibleposition[36])){ 222 setnewTarget(28,35); 223 } 224 else if(findpos(actuelposition,possibleposition[37])){ 225 setnewTarget(27,38); 226 } 227 else if(findpos(actuelposition,possibleposition[38])){ 228 setnewTarget(9,37,39); 229 } 230 else if(findpos(actuelposition,possibleposition[39])){ 231 setnewTarget(38,40,45); 232 } 233 else if(findpos(actuelposition,possibleposition[40])){ 234 setnewTarget(39,41); //Shouldn't be able to return in center 235 } 236 else if(findpos(actuelposition,possibleposition[41])){ 237 setnewTarget(35,43); 238 } 239 else if(findpos(actuelposition,possibleposition[42])){ 240 setnewTarget(34,43,54); 241 } 242 else if(findpos(actuelposition,possibleposition[43])){ 243 setnewTarget(41,46); 244 } 245 else if(findpos(actuelposition,possibleposition[44])){ 246 setnewTarget(40,66); 247 } 248 else if(findpos(actuelposition,possibleposition[45])){ 249 setnewTarget(10,39,49); 250 } 251 else if(findpos(actuelposition,possibleposition[46])){ 252 setnewTarget(43,47); 253 } 254 else if(findpos(actuelposition,possibleposition[47])){ 255 setnewTarget(46,52,66); 256 } 257 else if(findpos(actuelposition,possibleposition[48])){ 258 setnewTarget(49,51,66); 259 } 260 else if(findpos(actuelposition,possibleposition[49])){ 261 setnewTarget(45,48); 262 } 263 else if(findpos(actuelposition,possibleposition[50])){ 264 setnewTarget(51,61); 265 } 266 else if(findpos(actuelposition,possibleposition[51])){ 267 setnewTarget(48,50); 268 } 269 else if(findpos(actuelposition,possibleposition[52])){ 270 setnewTarget(47,53); 271 } 272 else if(findpos(actuelposition,possibleposition[53])){ 273 setnewTarget(52,58); 274 } 275 else if(findpos(actuelposition,possibleposition[54])){ 276 setnewTarget(42,55,57); 277 } 278 else if(findpos(actuelposition,possibleposition[55])){ 279 setnewTarget(54,56); 280 } 281 else if(findpos(actuelposition,possibleposition[56])){ 282 setnewTarget(55,57,65); 283 } 284 else if(findpos(actuelposition,possibleposition[57])){ 285 setnewTarget(54,56,58,64); 286 } 287 else if(findpos(actuelposition,possibleposition[58])){ 288 setnewTarget(53,57,59); 289 } 290 else if(findpos(actuelposition,possibleposition[59])){ 291 setnewTarget(58,59,63); 292 } 293 else if(findpos(actuelposition,possibleposition[60])){ 294 setnewTarget(59,61,62); 295 } 296 else if(findpos(actuelposition,possibleposition[61])){ 297 setnewTarget(13,50,60); 298 } 299 else if(findpos(actuelposition,possibleposition[62])){ 300 setnewTarget(16,60); 301 } 302 else if(findpos(actuelposition,possibleposition[63])){ 303 setnewTarget(59,64); 304 } 305 else if(findpos(actuelposition,possibleposition[64])){ 306 setnewTarget(57,63,65); 307 } 308 else if(findpos(actuelposition,possibleposition[65])){ 309 setnewTarget(56,64); 310 } 311 else if(findpos(actuelposition,possibleposition[66])){ 312 setnewTarget(47,48); 313 } 314 315 else{ 316 this->resetGhost(); //Shouldn't happen... 317 } //End of Position table 318 lockmove = false; 319 } 320 321 //end of function 322 323 324 } 325 326 private: 327 328 329 330 //end of class 331 }; 332 333 334 //namespae orxonox 335 } 350 } 351 352 353 } -
code/branches/3DPacman_FS19/src/modules/pacman/getShortestPath.cc
r12293 r12304 1 1 #include "core/CoreIncludes.h" 2 2 #include "core/XMLPort.h" 3 #include "getShortestPath.h" 3 //#include "getShortestPath.h" 4 #include "PacmanGhost.h" 4 5 5 6 … … 9 10 namespace orxonox{ 10 11 11 //Check if there is a collision12 bool jeanfindpos(Vector3 one, Vector3 other){13 if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true;14 return false;15 }16 17 struct graphVertex;18 void findNeighboorVertices(Vector3 actuelposition, graphVertex adjacentVertices[]);19 void updateShortestDistanceToStart(graphVertex &vertex, graphVertex &neighboor);20 graphVertex findNextVertexToConsider(graphVertex[]);21 12 struct graphVertex { 22 13 … … 57 48 }; 58 49 50 graphVertex listOfVertices[67]; 59 51 60 52 Vector3 getShortestPath(Vector3 start, Vector3 goal){ … … 66 58 return start; 67 59 } 68 69 //All positions in the map, see documentation70 Vector3 possibleposition[] = {Vector3(20,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195), //0-471 Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-972 Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-1473 Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-1974 Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-2475 Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-2976 Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-3477 Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-3978 Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-4479 Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-4980 Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-5481 Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-5982 Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-6483 Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-6684 85 graphVertex listOfVertices[67]= { graphVertex()}; //list of all vertices in the map. // We need graphVertex()86 60 87 61 … … 90 64 } 91 65 92 graphVertex actualVertex ;66 graphVertex actualVertex= graphVertex(start); 93 67 94 68 actualVertex.alreadyVisited=true; … … 168 142 169 143 170 graphVertex findNextVertexToConsider(graphVertex listOfVertices []){ //find next, nearest from start, non visited vertex144 graphVertex findNextVertexToConsider(graphVertex listOfVerticesP[]){ //find next, nearest from start, non visited vertex 171 145 172 146 int shortestDistance = -1; … … 175 149 for(int i=0; i < 67; i++){ //we loop over all possible positions 176 150 177 if(listOfVertices [i].alreadyVisited==true){ //vertex should already be visited178 179 findNearestNonVisitedNeighboor(listOfVertices [i]); //we update nearest neighboor151 if(listOfVerticesP[i].alreadyVisited==true){ //vertex should already be visited 152 153 findNearestNonVisitedNeighboor(listOfVerticesP[i]); //we update nearest neighboor 180 154 //of all visited vertices given that one of the nearest neighboor of a visited 181 155 // vertex is now also visited because it was chosen as next optimal vertex 182 156 183 if(listOfVertices [i].currentNearestNonVisitedNeighboor!=NULL){ //we want a candidate!157 if(listOfVerticesP[i].currentNearestNonVisitedNeighboor!=NULL){ //we want a candidate! 184 158 if(shortestDistance==-1){ //our first possible candidate 185 159 186 shortestDistance=graphDistance(listOfVertices [i].position,187 listOfVertices [i].currentNearestNonVisitedNeighboor->position) +188 listOfVertices [i].shortestDistanceToStart;189 190 nextVertexToConsider=listOfVertices [i].currentNearestNonVisitedNeighboor;191 192 } 193 else if(shortestDistance > graphDistance(listOfVertices [i].position,194 listOfVertices [i].currentNearestNonVisitedNeighboor->position) +195 listOfVertices [i].shortestDistanceToStart){196 197 shortestDistance=graphDistance(listOfVertices [i].position,198 listOfVertices [i].currentNearestNonVisitedNeighboor->position) +199 listOfVertices [i].shortestDistanceToStart;200 201 nextVertexToConsider=listOfVertices [i].currentNearestNonVisitedNeighboor;160 shortestDistance=graphDistance(listOfVerticesP[i].position, 161 listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 162 listOfVerticesP[i].shortestDistanceToStart; 163 164 nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor; 165 166 } 167 else if(shortestDistance > graphDistance(listOfVerticesP[i].position, 168 listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 169 listOfVerticesP[i].shortestDistanceToStart){ 170 171 shortestDistance=graphDistance(listOfVerticesP[i].position, 172 listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + 173 listOfVerticesP[i].shortestDistanceToStart; 174 175 nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor; 202 176 } 203 177 } … … 218 192 //-195 -135 -85 -35 15 60 105 150 195 245 219 193 220 void findNeighboorVertices(Vector3 actuelposition, graphVertex adjacentVertices[]){ 221 222 //All positions in the map, see documentation 223 Vector3 possibleposition[] = {Vector3(20,10,245),Vector3(215,10,245),Vector3(215,10,195),Vector3(185,10,195),Vector3(135,10,195), //0-4 224 Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9 225 Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-14 226 Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-19 227 Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-24 228 Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-29 229 Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-34 230 Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-39 231 Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-44 232 Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-49 233 Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-54 234 Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-59 235 Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-64 236 Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-66 237 238 239 240 241 if(jeanfindpos(actuelposition,possibleposition[0])){ 194 void findNeighboorVertices(Vector3 actuelposition, graphVertex* adjacentVertices[]){ 195 196 197 if(findpos(actuelposition,possibleposition[0])){ 242 198 // we should use listOfVertices[i] instead of possibleposition[i] I think 243 199 // so that all neighboors are "the same" 244 adjacentVertices[0]= graphVertex(possibleposition[1]); //need to do it everywhere !!!245 adjacentVertices[1]= graphVertex(possibleposition[17]);246 adjacentVertices[2]= possibleposition[19]; //maybe a vector would be more suitable ?247 } 248 else if( jeanfindpos(actuelposition,possibleposition[1])){249 adjacentVertices[0]= possibleposition[0];250 adjacentVertices[1]= possibleposition[2];251 } 252 else if( jeanfindpos(actuelposition,possibleposition[2])){253 adjacentVertices[0]= possibleposition[1];254 adjacentVertices[1]= possibleposition[3];255 } 256 else if( jeanfindpos(actuelposition,possibleposition[3])){257 adjacentVertices[0]= possibleposition[2];258 adjacentVertices[1]= possibleposition[4];259 adjacentVertices[2]= possibleposition[5];260 } 261 else if( jeanfindpos(actuelposition,possibleposition[4])){262 adjacentVertices[0]= possibleposition[3];263 adjacentVertices[1]= possibleposition[6];264 } 265 else if( jeanfindpos(actuelposition,possibleposition[5])){266 adjacentVertices[0]= possibleposition[3];267 adjacentVertices[1]= possibleposition[7];268 } 269 else if( jeanfindpos(actuelposition,possibleposition[6])){270 adjacentVertices[0]= possibleposition[4];271 adjacentVertices[1]= possibleposition[9];272 adjacentVertices[2]= possibleposition[26];273 } 274 else if( jeanfindpos(actuelposition,possibleposition[7])){275 adjacentVertices[0]= possibleposition[5];276 adjacentVertices[1]= possibleposition[8];277 } 278 else if( jeanfindpos(actuelposition,possibleposition[8])){279 adjacentVertices[0]= possibleposition[7];280 adjacentVertices[1]= possibleposition[9];281 } 282 else if( jeanfindpos(actuelposition,possibleposition[9])){283 adjacentVertices[0]= possibleposition[6];284 adjacentVertices[1]= possibleposition[8];285 adjacentVertices[2]= possibleposition[10];286 adjacentVertices[3]= possibleposition[38];287 } 288 else if( jeanfindpos(actuelposition,possibleposition[10])){289 adjacentVertices[0]= possibleposition[9];290 adjacentVertices[1]= possibleposition[11];291 adjacentVertices[2]= possibleposition[45];292 } 293 else if( jeanfindpos(actuelposition,possibleposition[11])){294 adjacentVertices[0]= possibleposition[10];295 adjacentVertices[1]= possibleposition[12];296 adjacentVertices[2]= possibleposition[13];297 } 298 else if( jeanfindpos(actuelposition,possibleposition[12])){299 adjacentVertices[0]= possibleposition[11];300 adjacentVertices[1]= possibleposition[14];301 } 302 else if( jeanfindpos(actuelposition,possibleposition[13])){303 adjacentVertices[0]= possibleposition[11];304 adjacentVertices[1]= possibleposition[14];305 adjacentVertices[2]= possibleposition[16];306 adjacentVertices[3]= possibleposition[61];307 } 308 else if( jeanfindpos(actuelposition,possibleposition[14])){309 adjacentVertices[0]= possibleposition[12];310 adjacentVertices[1]= possibleposition[13];311 adjacentVertices[2]= possibleposition[15];312 } 313 else if( jeanfindpos(actuelposition,possibleposition[15])){314 adjacentVertices[0]= possibleposition[14];315 adjacentVertices[1]= possibleposition[16];316 } 317 else if( jeanfindpos(actuelposition,possibleposition[16])){318 adjacentVertices[0]= possibleposition[13];319 adjacentVertices[1]= possibleposition[15];320 adjacentVertices[2]= possibleposition[62];321 } 322 else if( jeanfindpos(actuelposition,possibleposition[17])){323 adjacentVertices[0]= possibleposition[0];324 adjacentVertices[1]= possibleposition[25];325 } 326 else if( jeanfindpos(actuelposition,possibleposition[18])){327 adjacentVertices[0]= possibleposition[19];328 adjacentVertices[1]= possibleposition[24];329 } 330 else if( jeanfindpos(actuelposition,possibleposition[19])){331 adjacentVertices[0]= possibleposition[0];332 adjacentVertices[1]= possibleposition[18];333 adjacentVertices[2]= possibleposition[20];200 adjacentVertices[0]=&listOfVertices[1]; //graphVertex(possibleposition[1]); //need to do it everywhere !!! 201 adjacentVertices[1]=&listOfVertices[17]; //graphVertex(possibleposition[17]); 202 adjacentVertices[2]=&listOfVertices[19]; //graphVertex(possibleposition[19]); //maybe a vector would be more suitable ? 203 } 204 else if(findpos(actuelposition,possibleposition[1])){ 205 adjacentVertices[0]=&listOfVertices[0]; //graphVertex(possibleposition[0]); 206 adjacentVertices[1]=&listOfVertices[2]; //graphVertex(possibleposition[2]); 207 } 208 else if(findpos(actuelposition,possibleposition[2])){ 209 adjacentVertices[0]=&listOfVertices[1]; //graphVertex(possibleposition[1]); 210 adjacentVertices[1]=&listOfVertices[3]; //graphVertex(possibleposition[3]); 211 } 212 else if(findpos(actuelposition,possibleposition[3])){ 213 adjacentVertices[0]=&listOfVertices[2]; //graphVertex(possibleposition[2]); 214 adjacentVertices[1]=&listOfVertices[4]; //graphVertex(possibleposition[4]); 215 adjacentVertices[2]=&listOfVertices[5]; //graphVertex(possibleposition[5]); 216 } 217 else if(findpos(actuelposition,possibleposition[4])){ 218 adjacentVertices[0]=&listOfVertices[3]; //graphVertex(possibleposition[3]); 219 adjacentVertices[1]=&listOfVertices[6]; //graphVertex(possibleposition[6]); 220 } 221 else if(findpos(actuelposition,possibleposition[5])){ 222 adjacentVertices[0]=&listOfVertices[3]; //graphVertex(possibleposition[3]); 223 adjacentVertices[1]=&listOfVertices[7]; //graphVertex(possibleposition[7]); 224 } 225 else if(findpos(actuelposition,possibleposition[6])){ 226 adjacentVertices[0]=&listOfVertices[4]; //graphVertex(possibleposition[4]); 227 adjacentVertices[1]=&listOfVertices[9]; //graphVertex(possibleposition[9]); 228 adjacentVertices[2]=&listOfVertices[26]; //graphVertex(possibleposition[26]); 229 } 230 else if(findpos(actuelposition,possibleposition[7])){ 231 adjacentVertices[0]=&listOfVertices[5]; //graphVertex(possibleposition[5]); 232 adjacentVertices[1]=&listOfVertices[8]; //graphVertex(possibleposition[8]); 233 } 234 else if(findpos(actuelposition,possibleposition[8])){ 235 adjacentVertices[0]=&listOfVertices[7]; //graphVertex(possibleposition[7]); 236 adjacentVertices[1]=&listOfVertices[9]; //graphVertex(possibleposition[9]); 237 } 238 else if(findpos(actuelposition,possibleposition[9])){ 239 adjacentVertices[0]=&listOfVertices[6]; //graphVertex(possibleposition[6]); 240 adjacentVertices[1]=&listOfVertices[8]; //graphVertex(possibleposition[8]); 241 adjacentVertices[2]=&listOfVertices[10]; //graphVertex(possibleposition[10]); 242 adjacentVertices[3]=&listOfVertices[38]; //graphVertex(possibleposition[38]); 243 } 244 else if(findpos(actuelposition,possibleposition[10])){ 245 adjacentVertices[0]=&listOfVertices[9]; //graphVertex(possibleposition[9]); 246 adjacentVertices[1]=&listOfVertices[11]; //graphVertex(possibleposition[11]); 247 adjacentVertices[2]=&listOfVertices[45]; //graphVertex(possibleposition[45]); 248 } 249 else if(findpos(actuelposition,possibleposition[11])){ 250 adjacentVertices[0]=&listOfVertices[10]; //graphVertex(possibleposition[10]); 251 adjacentVertices[1]=&listOfVertices[12]; //graphVertex(possibleposition[12]); 252 adjacentVertices[2]=&listOfVertices[13]; //graphVertex(possibleposition[13]); 253 } 254 else if(findpos(actuelposition,possibleposition[12])){ 255 adjacentVertices[0]=&listOfVertices[11]; //graphVertex(possibleposition[11]); 256 adjacentVertices[1]=&listOfVertices[14]; //graphVertex(possibleposition[14]); 257 } 258 else if(findpos(actuelposition,possibleposition[13])){ 259 adjacentVertices[0]=&listOfVertices[11]; //graphVertex(possibleposition[11]); 260 adjacentVertices[1]=&listOfVertices[14]; //graphVertex(possibleposition[14]); 261 adjacentVertices[2]=&listOfVertices[16]; //graphVertex(possibleposition[16]); 262 adjacentVertices[3]=&listOfVertices[61]; //graphVertex(possibleposition[61]); 263 } 264 else if(findpos(actuelposition,possibleposition[14])){ 265 adjacentVertices[0]=&listOfVertices[12]; //graphVertex(possibleposition[12]); 266 adjacentVertices[1]=&listOfVertices[13]; //graphVertex(possibleposition[13]); 267 adjacentVertices[2]=&listOfVertices[15]; //graphVertex(possibleposition[15]); 268 } 269 else if(findpos(actuelposition,possibleposition[15])){ 270 adjacentVertices[0]=&listOfVertices[14]; //graphVertex(possibleposition[14]); 271 adjacentVertices[1]=&listOfVertices[16]; //graphVertex(possibleposition[16]); 272 } 273 else if(findpos(actuelposition,possibleposition[16])){ 274 adjacentVertices[0]=&listOfVertices[13]; //graphVertex(possibleposition[13]); 275 adjacentVertices[1]=&listOfVertices[15]; //graphVertex(possibleposition[15]); 276 adjacentVertices[2]=&listOfVertices[62]; //graphVertex(possibleposition[62]); 277 } 278 else if(findpos(actuelposition,possibleposition[17])){ 279 adjacentVertices[0]=&listOfVertices[0]; //graphVertex(possibleposition[0]); 280 adjacentVertices[1]=&listOfVertices[25]; //graphVertex(possibleposition[25]); 281 } 282 else if(findpos(actuelposition,possibleposition[18])){ 283 adjacentVertices[0]=&listOfVertices[19]; //graphVertex(possibleposition[19]); 284 adjacentVertices[1]=&listOfVertices[24]; //graphVertex(possibleposition[24]); 285 } 286 else if(findpos(actuelposition,possibleposition[19])){ 287 adjacentVertices[0]=&listOfVertices[0]; //graphVertex(possibleposition[0]); 288 adjacentVertices[1]=&listOfVertices[18]; //graphVertex(possibleposition[18]); 289 adjacentVertices[2]=&listOfVertices[20]; //graphVertex(possibleposition[20]); 334 290 } 335 else if( jeanfindpos(actuelposition,possibleposition[20])){336 adjacentVertices[0]= possibleposition[19];337 adjacentVertices[1]= possibleposition[21];338 } 339 else if( jeanfindpos(actuelposition,possibleposition[21])){340 adjacentVertices[0]= possibleposition[20];341 adjacentVertices[1]= possibleposition[22];342 } 343 else if( jeanfindpos(actuelposition,possibleposition[22])){344 adjacentVertices[0]= possibleposition[21];345 adjacentVertices[1]= possibleposition[23];346 adjacentVertices[2]= possibleposition[31];347 } 348 else if( jeanfindpos(actuelposition,possibleposition[23])){349 adjacentVertices[0]= possibleposition[22];350 adjacentVertices[1]= possibleposition[30];351 } 352 else if( jeanfindpos(actuelposition,possibleposition[24])){353 adjacentVertices[0]= possibleposition[18];354 adjacentVertices[1]= possibleposition[29];355 } 356 else if( jeanfindpos(actuelposition,possibleposition[25])){357 adjacentVertices[0]= possibleposition[17];358 adjacentVertices[1]= possibleposition[26];359 } 360 else if( jeanfindpos(actuelposition,possibleposition[26])){361 adjacentVertices[0]= possibleposition[6];362 adjacentVertices[1]= possibleposition[25];363 adjacentVertices[2]= possibleposition[27];291 else if(findpos(actuelposition,possibleposition[20])){ 292 adjacentVertices[0]=&listOfVertices[19]; //graphVertex(possibleposition[19]); 293 adjacentVertices[1]=&listOfVertices[21]; //graphVertex(possibleposition[21]); 294 } 295 else if(findpos(actuelposition,possibleposition[21])){ 296 adjacentVertices[0]=&listOfVertices[20]; //graphVertex(possibleposition[20]); 297 adjacentVertices[1]=&listOfVertices[22]; //graphVertex(possibleposition[22]); 298 } 299 else if(findpos(actuelposition,possibleposition[22])){ 300 adjacentVertices[0]=&listOfVertices[21]; //graphVertex(possibleposition[21]); 301 adjacentVertices[1]=&listOfVertices[23]; //graphVertex(possibleposition[23]); 302 adjacentVertices[2]=&listOfVertices[31]; //graphVertex(possibleposition[31]); 303 } 304 else if(findpos(actuelposition,possibleposition[23])){ 305 adjacentVertices[0]=&listOfVertices[22]; //graphVertex(possibleposition[22]); 306 adjacentVertices[1]=&listOfVertices[30]; //graphVertex(possibleposition[30]); 307 } 308 else if(findpos(actuelposition,possibleposition[24])){ 309 adjacentVertices[0]=&listOfVertices[18]; //graphVertex(possibleposition[18]); 310 adjacentVertices[1]=&listOfVertices[29]; //graphVertex(possibleposition[29]); 311 } 312 else if(findpos(actuelposition,possibleposition[25])){ 313 adjacentVertices[0]=&listOfVertices[17]; //graphVertex(possibleposition[17]); 314 adjacentVertices[1]=&listOfVertices[26]; //graphVertex(possibleposition[26]); 315 } 316 else if(findpos(actuelposition,possibleposition[26])){ 317 adjacentVertices[0]=&listOfVertices[6]; //graphVertex(possibleposition[6]); 318 adjacentVertices[1]=&listOfVertices[25]; //graphVertex(possibleposition[25]); 319 adjacentVertices[2]=&listOfVertices[27]; //graphVertex(possibleposition[27]); 364 320 } 365 else if( jeanfindpos(actuelposition,possibleposition[27])){366 adjacentVertices[0]= possibleposition[26];367 adjacentVertices[1]= possibleposition[28];368 adjacentVertices[2]= possibleposition[37];369 } 370 else if( jeanfindpos(actuelposition,possibleposition[28])){371 adjacentVertices[0]= possibleposition[27];372 adjacentVertices[1]= possibleposition[29];373 adjacentVertices[2]= possibleposition[36];374 } 375 else if( jeanfindpos(actuelposition,possibleposition[29])){376 adjacentVertices[0]= possibleposition[24];377 adjacentVertices[1]= possibleposition[28];378 adjacentVertices[2]= possibleposition[30];379 } 380 else if( jeanfindpos(actuelposition,possibleposition[30])){381 adjacentVertices[0]= possibleposition[23];382 adjacentVertices[1]= possibleposition[29];383 adjacentVertices[2]= possibleposition[34];384 } 385 else if( jeanfindpos(actuelposition,possibleposition[31])){386 adjacentVertices[0]= possibleposition[22];387 adjacentVertices[1]= possibleposition[32];388 } 389 else if( jeanfindpos(actuelposition,possibleposition[32])){390 adjacentVertices[0]= possibleposition[31];391 adjacentVertices[1]= possibleposition[33];392 } 393 else if( jeanfindpos(actuelposition,possibleposition[33])){394 adjacentVertices[0]= possibleposition[32];395 adjacentVertices[1]= possibleposition[34];396 } 397 else if( jeanfindpos(actuelposition,possibleposition[34])){398 adjacentVertices[0]= possibleposition[30];399 adjacentVertices[1]= possibleposition[33];400 adjacentVertices[2]= possibleposition[35];401 adjacentVertices[3]= possibleposition[42];321 else if(findpos(actuelposition,possibleposition[27])){ 322 adjacentVertices[0]=&listOfVertices[26]; //graphVertex(possibleposition[26]); 323 adjacentVertices[1]=&listOfVertices[28]; //graphVertex(possibleposition[28]); 324 adjacentVertices[2]=&listOfVertices[37]; //graphVertex(possibleposition[37]); 325 } 326 else if(findpos(actuelposition,possibleposition[28])){ 327 adjacentVertices[0]=&listOfVertices[27]; //graphVertex(possibleposition[27]); 328 adjacentVertices[1]=&listOfVertices[29]; //graphVertex(possibleposition[29]); 329 adjacentVertices[2]=&listOfVertices[36]; //graphVertex(possibleposition[36]); 330 } 331 else if(findpos(actuelposition,possibleposition[29])){ 332 adjacentVertices[0]=&listOfVertices[24]; //graphVertex(possibleposition[24]); 333 adjacentVertices[1]=&listOfVertices[28]; //graphVertex(possibleposition[28]); 334 adjacentVertices[2]=&listOfVertices[30]; //graphVertex(possibleposition[30]); 335 } 336 else if(findpos(actuelposition,possibleposition[30])){ 337 adjacentVertices[0]=&listOfVertices[23]; //graphVertex(possibleposition[23]); 338 adjacentVertices[1]=&listOfVertices[29]; //graphVertex(possibleposition[29]); 339 adjacentVertices[2]=&listOfVertices[34]; //graphVertex(possibleposition[34]); 340 } 341 else if(findpos(actuelposition,possibleposition[31])){ 342 adjacentVertices[0]=&listOfVertices[22]; //graphVertex(possibleposition[22]); 343 adjacentVertices[1]=&listOfVertices[32]; //graphVertex(possibleposition[32]); 344 } 345 else if(findpos(actuelposition,possibleposition[32])){ 346 adjacentVertices[0]=&listOfVertices[31]; //graphVertex(possibleposition[31]); 347 adjacentVertices[1]=&listOfVertices[33]; //graphVertex(possibleposition[33]); 348 } 349 else if(findpos(actuelposition,possibleposition[33])){ 350 adjacentVertices[0]=&listOfVertices[32]; //graphVertex(possibleposition[32]); 351 adjacentVertices[1]=&listOfVertices[34]; //graphVertex(possibleposition[34]); 352 } 353 else if(findpos(actuelposition,possibleposition[34])){ 354 adjacentVertices[0]=&listOfVertices[30]; //graphVertex(possibleposition[30]); 355 adjacentVertices[1]=&listOfVertices[33]; //graphVertex(possibleposition[33]); 356 adjacentVertices[2]=&listOfVertices[35]; //graphVertex(possibleposition[35]); 357 adjacentVertices[3]=&listOfVertices[42]; //graphVertex(possibleposition[42]); 402 358 403 359 } 404 else if( jeanfindpos(actuelposition,possibleposition[35])){405 adjacentVertices[0]= possibleposition[34];406 adjacentVertices[1]= possibleposition[36];407 adjacentVertices[2]= possibleposition[41];408 } 409 else if( jeanfindpos(actuelposition,possibleposition[36])){410 adjacentVertices[0]= possibleposition[28];411 adjacentVertices[1]= possibleposition[35];412 } 413 else if( jeanfindpos(actuelposition,possibleposition[37])){414 adjacentVertices[0]= possibleposition[27];415 adjacentVertices[1]= possibleposition[38];416 } 417 else if( jeanfindpos(actuelposition,possibleposition[38])){418 adjacentVertices[0]= possibleposition[9];419 adjacentVertices[1]= possibleposition[37];420 adjacentVertices[2]= possibleposition[39];360 else if(findpos(actuelposition,possibleposition[35])){ 361 adjacentVertices[0]=&listOfVertices[34]; //graphVertex(possibleposition[34]); 362 adjacentVertices[1]=&listOfVertices[36]; //graphVertex(possibleposition[36]); 363 adjacentVertices[2]=&listOfVertices[41]; //graphVertex(possibleposition[41]); 364 } 365 else if(findpos(actuelposition,possibleposition[36])){ 366 adjacentVertices[0]=&listOfVertices[28]; //graphVertex(possibleposition[28]); 367 adjacentVertices[1]=&listOfVertices[35]; //graphVertex(possibleposition[35]); 368 } 369 else if(findpos(actuelposition,possibleposition[37])){ 370 adjacentVertices[0]=&listOfVertices[27]; //graphVertex(possibleposition[27]); 371 adjacentVertices[1]=&listOfVertices[38]; //graphVertex(possibleposition[38]); 372 } 373 else if(findpos(actuelposition,possibleposition[38])){ 374 adjacentVertices[0]=&listOfVertices[9]; //graphVertex(possibleposition[9]); 375 adjacentVertices[1]=&listOfVertices[37]; //graphVertex(possibleposition[37]); 376 adjacentVertices[2]=&listOfVertices[39]; //graphVertex(possibleposition[39]); 421 377 } 422 else if( jeanfindpos(actuelposition,possibleposition[39])){423 adjacentVertices[0]= possibleposition[38];424 adjacentVertices[1]= possibleposition[40];425 adjacentVertices[2]= possibleposition[45];426 } 427 else if( jeanfindpos(actuelposition,possibleposition[40])){428 adjacentVertices[0]= possibleposition[39];429 adjacentVertices[1]= possibleposition[41];430 } 431 else if( jeanfindpos(actuelposition,possibleposition[41])){432 adjacentVertices[0]= possibleposition[35];433 adjacentVertices[1]= possibleposition[43];434 } 435 else if( jeanfindpos(actuelposition,possibleposition[42])){436 adjacentVertices[0]= possibleposition[34];437 adjacentVertices[1]= possibleposition[43];438 adjacentVertices[2]= possibleposition[54];439 } 440 else if( jeanfindpos(actuelposition,possibleposition[43])){441 adjacentVertices[0]= possibleposition[41];442 adjacentVertices[1]= possibleposition[46];443 } 444 else if( jeanfindpos(actuelposition,possibleposition[44])){445 adjacentVertices[0]= possibleposition[40];446 adjacentVertices[1]= possibleposition[66];447 } 448 else if( jeanfindpos(actuelposition,possibleposition[45])){449 adjacentVertices[0]= possibleposition[10];450 adjacentVertices[1]= possibleposition[39];451 adjacentVertices[2]= possibleposition[49];452 } 453 else if( jeanfindpos(actuelposition,possibleposition[46])){454 adjacentVertices[0]= possibleposition[43];455 adjacentVertices[1]= possibleposition[47];456 } 457 else if( jeanfindpos(actuelposition,possibleposition[47])){458 adjacentVertices[0]= possibleposition[46];459 adjacentVertices[1]= possibleposition[52];460 adjacentVertices[2]= possibleposition[66];461 } 462 else if( jeanfindpos(actuelposition,possibleposition[48])){463 adjacentVertices[0]= possibleposition[49];464 adjacentVertices[1]= possibleposition[51];465 adjacentVertices[2]= possibleposition[66];466 } 467 else if( jeanfindpos(actuelposition,possibleposition[49])){468 adjacentVertices[0]= possibleposition[45];469 adjacentVertices[1]= possibleposition[48];470 } 471 else if( jeanfindpos(actuelposition,possibleposition[50])){472 adjacentVertices[0]= possibleposition[51];473 adjacentVertices[1]= possibleposition[61];474 } 475 else if( jeanfindpos(actuelposition,possibleposition[51])){476 adjacentVertices[0]= possibleposition[48];477 adjacentVertices[1]= possibleposition[50];478 } 479 else if( jeanfindpos(actuelposition,possibleposition[52])){480 adjacentVertices[0]= possibleposition[47];481 adjacentVertices[1]= possibleposition[53];482 } 483 else if( jeanfindpos(actuelposition,possibleposition[53])){484 adjacentVertices[0]= possibleposition[52];485 adjacentVertices[1]= possibleposition[58];486 } 487 else if( jeanfindpos(actuelposition,possibleposition[54])){488 adjacentVertices[0]= possibleposition[42];489 adjacentVertices[1]= possibleposition[55];490 adjacentVertices[2]= possibleposition[57];491 } 492 else if( jeanfindpos(actuelposition,possibleposition[55])){493 adjacentVertices[0]= possibleposition[54];494 adjacentVertices[1]= possibleposition[56];495 } 496 else if( jeanfindpos(actuelposition,possibleposition[56])){497 adjacentVertices[0]= possibleposition[55];498 adjacentVertices[1]= possibleposition[57];499 adjacentVertices[2]= possibleposition[65];500 } 501 else if( jeanfindpos(actuelposition,possibleposition[57])){502 adjacentVertices[0]= possibleposition[54];503 adjacentVertices[1]= possibleposition[56];504 adjacentVertices[2]= possibleposition[58];505 adjacentVertices[3]= possibleposition[64];378 else if(findpos(actuelposition,possibleposition[39])){ 379 adjacentVertices[0]=&listOfVertices[38]; //graphVertex(possibleposition[38]); 380 adjacentVertices[1]=&listOfVertices[40]; //graphVertex(possibleposition[40]); 381 adjacentVertices[2]=&listOfVertices[45]; //graphVertex(possibleposition[45]); 382 } 383 else if(findpos(actuelposition,possibleposition[40])){ 384 adjacentVertices[0]=&listOfVertices[39]; //graphVertex(possibleposition[39]); 385 adjacentVertices[1]=&listOfVertices[41]; //graphVertex(possibleposition[41]); 386 } 387 else if(findpos(actuelposition,possibleposition[41])){ 388 adjacentVertices[0]=&listOfVertices[35]; //graphVertex(possibleposition[35]); 389 adjacentVertices[1]=&listOfVertices[43]; //graphVertex(possibleposition[43]); 390 } 391 else if(findpos(actuelposition,possibleposition[42])){ 392 adjacentVertices[0]=&listOfVertices[34]; //graphVertex(possibleposition[34]); 393 adjacentVertices[1]=&listOfVertices[43]; //graphVertex(possibleposition[43]); 394 adjacentVertices[2]=&listOfVertices[54]; //graphVertex(possibleposition[54]); 395 } 396 else if(findpos(actuelposition,possibleposition[43])){ 397 adjacentVertices[0]=&listOfVertices[41]; //graphVertex(possibleposition[41]); 398 adjacentVertices[1]=&listOfVertices[46]; //graphVertex(possibleposition[46]); 399 } 400 else if(findpos(actuelposition,possibleposition[44])){ 401 adjacentVertices[0]=&listOfVertices[40]; //graphVertex(possibleposition[40]); 402 adjacentVertices[1]=&listOfVertices[66]; //graphVertex(possibleposition[66]); 403 } 404 else if(findpos(actuelposition,possibleposition[45])){ 405 adjacentVertices[0]=&listOfVertices[10]; //graphVertex(possibleposition[10]); 406 adjacentVertices[1]=&listOfVertices[39]; //graphVertex(possibleposition[39]); 407 adjacentVertices[2]=&listOfVertices[49]; //graphVertex(possibleposition[49]); 408 } 409 else if(findpos(actuelposition,possibleposition[46])){ 410 adjacentVertices[0]=&listOfVertices[43]; //graphVertex(possibleposition[43]); 411 adjacentVertices[1]=&listOfVertices[47]; //graphVertex(possibleposition[47]); 412 } 413 else if(findpos(actuelposition,possibleposition[47])){ 414 adjacentVertices[0]=&listOfVertices[46]; //graphVertex(possibleposition[46]); 415 adjacentVertices[1]=&listOfVertices[52]; //graphVertex(possibleposition[52]); 416 adjacentVertices[2]=&listOfVertices[66]; //graphVertex(possibleposition[66]); 417 } 418 else if(findpos(actuelposition,possibleposition[48])){ 419 adjacentVertices[0]=&listOfVertices[49]; //graphVertex(possibleposition[49]); 420 adjacentVertices[1]=&listOfVertices[51]; //graphVertex(possibleposition[51]); 421 adjacentVertices[2]=&listOfVertices[66]; //graphVertex(possibleposition[66]); 422 } 423 else if(findpos(actuelposition,possibleposition[49])){ 424 adjacentVertices[0]=&listOfVertices[45]; //graphVertex(possibleposition[45]); 425 adjacentVertices[1]=&listOfVertices[48]; //graphVertex(possibleposition[48]); 426 } 427 else if(findpos(actuelposition,possibleposition[50])){ 428 adjacentVertices[0]=&listOfVertices[51]; //graphVertex(possibleposition[51]); 429 adjacentVertices[1]=&listOfVertices[61]; //graphVertex(possibleposition[61]); 430 } 431 else if(findpos(actuelposition,possibleposition[51])){ 432 adjacentVertices[0]=&listOfVertices[48]; //graphVertex(possibleposition[48]); 433 adjacentVertices[1]=&listOfVertices[50]; //graphVertex(possibleposition[50]); 434 } 435 else if(findpos(actuelposition,possibleposition[52])){ 436 adjacentVertices[0]=&listOfVertices[47]; //graphVertex(possibleposition[47]); 437 adjacentVertices[1]=&listOfVertices[53]; //graphVertex(possibleposition[53]); 438 } 439 else if(findpos(actuelposition,possibleposition[53])){ 440 adjacentVertices[0]=&listOfVertices[52]; //graphVertex(possibleposition[52]); 441 adjacentVertices[1]=&listOfVertices[58]; //graphVertex(possibleposition[58]); 442 } 443 else if(findpos(actuelposition,possibleposition[54])){ 444 adjacentVertices[0]=&listOfVertices[42]; //graphVertex(possibleposition[42]); 445 adjacentVertices[1]=&listOfVertices[55]; //graphVertex(possibleposition[55]); 446 adjacentVertices[2]=&listOfVertices[57]; //graphVertex(possibleposition[57]); 447 } 448 else if(findpos(actuelposition,possibleposition[55])){ 449 adjacentVertices[0]=&listOfVertices[54]; //graphVertex(possibleposition[54]); 450 adjacentVertices[1]=&listOfVertices[56]; //graphVertex(possibleposition[56]); 451 } 452 else if(findpos(actuelposition,possibleposition[56])){ 453 adjacentVertices[0]=&listOfVertices[55]; //graphVertex(possibleposition[55]); 454 adjacentVertices[1]=&listOfVertices[57]; //graphVertex(possibleposition[57]); 455 adjacentVertices[2]=&listOfVertices[65]; //graphVertex(possibleposition[65]); 456 } 457 else if(findpos(actuelposition,possibleposition[57])){ 458 adjacentVertices[0]=&listOfVertices[54]; //graphVertex(possibleposition[54]); 459 adjacentVertices[1]=&listOfVertices[56]; //graphVertex(possibleposition[56]); 460 adjacentVertices[2]=&listOfVertices[58]; //graphVertex(possibleposition[58]); 461 adjacentVertices[3]=&listOfVertices[64]; //graphVertex(possibleposition[64]); 506 462 507 463 } 508 else if( jeanfindpos(actuelposition,possibleposition[58])){509 adjacentVertices[0]= possibleposition[53];510 adjacentVertices[1]= possibleposition[57];511 adjacentVertices[2]= possibleposition[59];512 } 513 else if( jeanfindpos(actuelposition,possibleposition[59])){514 adjacentVertices[0]= possibleposition[58];515 adjacentVertices[1]= possibleposition[59];516 adjacentVertices[2]= possibleposition[63];517 } 518 else if( jeanfindpos(actuelposition,possibleposition[60])){519 adjacentVertices[0]= possibleposition[59];520 adjacentVertices[1]= possibleposition[61];521 adjacentVertices[2]= possibleposition[62];522 } 523 else if( jeanfindpos(actuelposition,possibleposition[61])){524 adjacentVertices[0]= possibleposition[13];525 adjacentVertices[1]= possibleposition[50];526 adjacentVertices[2]= possibleposition[60];527 } 528 else if( jeanfindpos(actuelposition,possibleposition[62])){529 adjacentVertices[0]= possibleposition[16];530 adjacentVertices[1]= possibleposition[60];531 } 532 else if( jeanfindpos(actuelposition,possibleposition[63])){533 adjacentVertices[0]= possibleposition[59];534 adjacentVertices[1]= possibleposition[64];535 } 536 else if( jeanfindpos(actuelposition,possibleposition[64])){537 adjacentVertices[0]= possibleposition[57];538 adjacentVertices[1]= possibleposition[63];539 adjacentVertices[2]= possibleposition[65];540 } 541 else if( jeanfindpos(actuelposition,possibleposition[65])){542 adjacentVertices[0]= possibleposition[56];543 adjacentVertices[1]= possibleposition[64];544 } 545 else if( jeanfindpos(actuelposition,possibleposition[66])){546 adjacentVertices[0]= possibleposition[47];547 adjacentVertices[1]= possibleposition[48];464 else if(findpos(actuelposition,possibleposition[58])){ 465 adjacentVertices[0]=&listOfVertices[53]; //graphVertex(possibleposition[53]); 466 adjacentVertices[1]=&listOfVertices[57]; //graphVertex(possibleposition[57]); 467 adjacentVertices[2]=&listOfVertices[59]; //graphVertex(possibleposition[59]); 468 } 469 else if(findpos(actuelposition,possibleposition[59])){ 470 adjacentVertices[0]=&listOfVertices[58]; //graphVertex(possibleposition[58]); 471 adjacentVertices[1]=&listOfVertices[59]; //graphVertex(possibleposition[59]); 472 adjacentVertices[2]=&listOfVertices[63]; //graphVertex(possibleposition[63]); 473 } 474 else if(findpos(actuelposition,possibleposition[60])){ 475 adjacentVertices[0]=&listOfVertices[59]; //graphVertex(possibleposition[59]); 476 adjacentVertices[1]=&listOfVertices[61]; //graphVertex(possibleposition[61]); 477 adjacentVertices[2]=&listOfVertices[62]; //graphVertex(possibleposition[62]); 478 } 479 else if(findpos(actuelposition,possibleposition[61])){ 480 adjacentVertices[0]=&listOfVertices[13]; //graphVertex(possibleposition[13]); 481 adjacentVertices[1]=&listOfVertices[50]; //graphVertex(possibleposition[50]); 482 adjacentVertices[2]=&listOfVertices[60]; //graphVertex(possibleposition[60]); 483 } 484 else if(findpos(actuelposition,possibleposition[62])){ 485 adjacentVertices[0]=&listOfVertices[16]; //graphVertex(possibleposition[16]); 486 adjacentVertices[1]=&listOfVertices[60]; //graphVertex(possibleposition[60]); 487 } 488 else if(findpos(actuelposition,possibleposition[63])){ 489 adjacentVertices[0]=&listOfVertices[59]; //graphVertex(possibleposition[59]); 490 adjacentVertices[1]=&listOfVertices[64]; //graphVertex(possibleposition[64]); 491 } 492 else if(findpos(actuelposition,possibleposition[64])){ 493 adjacentVertices[0]=&listOfVertices[57]; //graphVertex(possibleposition[57]); 494 adjacentVertices[1]=&listOfVertices[63]; //graphVertex(possibleposition[63]); 495 adjacentVertices[2]=&listOfVertices[65]; //graphVertex(possibleposition[65]); 496 } 497 else if(findpos(actuelposition,possibleposition[65])){ 498 adjacentVertices[0]=&listOfVertices[56]; //graphVertex(possibleposition[56]); 499 adjacentVertices[1]=&listOfVertices[64]; //graphVertex(possibleposition[64]); 500 } 501 else if(findpos(actuelposition,possibleposition[66])){ 502 adjacentVertices[0]=&listOfVertices[47]; //graphVertex(possibleposition[47]); 503 adjacentVertices[1]=&listOfVertices[48]; //graphVertex(possibleposition[48]); 548 504 } 549 505 } 550 506 507 551 508 }
Note: See TracChangeset
for help on using the changeset viewer.