1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Marc Dreher |
---|
24 | * Co-authors: |
---|
25 | * .. |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #include "PacmanGhost.h" |
---|
30 | |
---|
31 | #include "core/CoreIncludes.h" |
---|
32 | #include "BulletDynamics/Dynamics/btRigidBody.h" |
---|
33 | |
---|
34 | #include <vector> |
---|
35 | |
---|
36 | namespace orxonox |
---|
37 | { |
---|
38 | |
---|
39 | |
---|
40 | struct PacmanGhost::graphVertex { |
---|
41 | |
---|
42 | public: |
---|
43 | |
---|
44 | Vector3 position; |
---|
45 | graphVertex *adjacentVertices[4]; //neighbooring vertices |
---|
46 | |
---|
47 | //would a vector of vector storing the neighboors not be more suitable ? |
---|
48 | |
---|
49 | int shortestDistanceToStart; //actual shortest distance to start point |
---|
50 | graphVertex* actuelPredecessor; //the predecessor giving the for now shortest |
---|
51 | //path to start |
---|
52 | graphVertex* currentNearestNonVisitedNeighboor; |
---|
53 | bool alreadyVisited; |
---|
54 | graphVertex(){ //default constructor |
---|
55 | position=0; |
---|
56 | shortestDistanceToStart= std::numeric_limits<int>::max(); |
---|
57 | actuelPredecessor=nullptr; |
---|
58 | alreadyVisited=false; |
---|
59 | for(int kl =0; kl <4;kl++){ |
---|
60 | adjacentVertices[kl]=nullptr; //first put all position in array listing neighboors to 0 |
---|
61 | } |
---|
62 | } |
---|
63 | graphVertex(Vector3 wantedPosition){ //normal constructor |
---|
64 | position=wantedPosition; |
---|
65 | shortestDistanceToStart= std::numeric_limits<int>::max(); //default distance is infinity |
---|
66 | actuelPredecessor=nullptr; |
---|
67 | alreadyVisited=false; |
---|
68 | for(int kl =0; kl <4;kl++){ |
---|
69 | adjacentVertices[kl]=nullptr; //first put all position in array listing neighboors to 0 |
---|
70 | } |
---|
71 | } |
---|
72 | graphVertex& operator = (const graphVertex &rightSide){ |
---|
73 | this->position=rightSide.position; |
---|
74 | this->shortestDistanceToStart=rightSide.shortestDistanceToStart; |
---|
75 | this->actuelPredecessor=rightSide.actuelPredecessor; |
---|
76 | this->currentNearestNonVisitedNeighboor=rightSide.currentNearestNonVisitedNeighboor; |
---|
77 | this->alreadyVisited=rightSide.alreadyVisited; |
---|
78 | |
---|
79 | return *this; |
---|
80 | } |
---|
81 | |
---|
82 | }; |
---|
83 | |
---|
84 | |
---|
85 | static PacmanGhost::graphVertex listOfVertices[67]; |
---|
86 | |
---|
87 | //Check if there is a collision |
---|
88 | bool findpos(Vector3 one, Vector3 other){ |
---|
89 | if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true; |
---|
90 | return false; |
---|
91 | } |
---|
92 | |
---|
93 | //All positions in the map, see documentation |
---|
94 | 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 |
---|
95 | Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9 |
---|
96 | Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-14 |
---|
97 | Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-19 |
---|
98 | Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-24 |
---|
99 | Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-29 |
---|
100 | Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-34 |
---|
101 | Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-39 |
---|
102 | Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-44 |
---|
103 | Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-49 |
---|
104 | Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-54 |
---|
105 | Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-59 |
---|
106 | Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-64 |
---|
107 | Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-66 |
---|
108 | |
---|
109 | RegisterClass(PacmanGhost); |
---|
110 | |
---|
111 | /** |
---|
112 | @brief |
---|
113 | Constructor. Registers the object and initializes some default values. |
---|
114 | @param creator |
---|
115 | The creator of this object. |
---|
116 | */ |
---|
117 | PacmanGhost::PacmanGhost(Context* context) : ControllableEntity(context) |
---|
118 | { |
---|
119 | RegisterObject(PacmanGhost); |
---|
120 | |
---|
121 | this->velocity = Vector3(0, 0, 0); |
---|
122 | |
---|
123 | this->setCollisionType(CollisionType::Dynamic); |
---|
124 | |
---|
125 | this->actuelposition = this->getPosition(); |
---|
126 | |
---|
127 | if(findpos(actuelposition, Vector3(0,-20,0))) |
---|
128 | dontmove = true; |
---|
129 | |
---|
130 | this->target_x = actuelposition.x; |
---|
131 | this->target_z = actuelposition.z; |
---|
132 | |
---|
133 | } |
---|
134 | |
---|
135 | /** |
---|
136 | @brief |
---|
137 | Destructor. Destroys ghost, if present. |
---|
138 | */ |
---|
139 | PacmanGhost::~PacmanGhost() |
---|
140 | { |
---|
141 | // Deletes the controller if the object was initialized and the pointer to the controller is not nullptr. |
---|
142 | } |
---|
143 | |
---|
144 | /** |
---|
145 | @brief |
---|
146 | Method for creating a ghost through XML. |
---|
147 | */ |
---|
148 | void PacmanGhost::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
149 | { |
---|
150 | SUPER(PacmanGhost, XMLPort, xmlelement, mode); |
---|
151 | } |
---|
152 | |
---|
153 | //Change this with other ghost |
---|
154 | void PacmanGhost::changewith(PacmanGhost* otherghost){ |
---|
155 | |
---|
156 | while(lockmove){}; |
---|
157 | lockmove = true; //Prevent change of target while ghost is changed |
---|
158 | |
---|
159 | otherghost->setPosition(this->getPosition()); |
---|
160 | this->setPosition(0,-20,0); |
---|
161 | otherghost->target_x = this->target_x; |
---|
162 | otherghost->target_z = this->target_z; |
---|
163 | otherghost->ismoving = this->ismoving; |
---|
164 | |
---|
165 | this->dontmove = true; |
---|
166 | otherghost->dontmove = false; |
---|
167 | |
---|
168 | lockmove = false; |
---|
169 | } |
---|
170 | |
---|
171 | //Move ghost with rotation |
---|
172 | void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){ |
---|
173 | if(!dontmove){ |
---|
174 | this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt)); |
---|
175 | |
---|
176 | //Rotate ghost in the direction of movement |
---|
177 | if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1)){ |
---|
178 | if(velocity.x<0){ |
---|
179 | this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0))); |
---|
180 | } |
---|
181 | else{ |
---|
182 | this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0))); |
---|
183 | } |
---|
184 | } |
---|
185 | if((abs(abs(velocity.z)-1)<0.1) && (abs(velocity.x-0)<0.1)){ |
---|
186 | if(velocity.z<0){ |
---|
187 | this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0))); |
---|
188 | } |
---|
189 | else{ |
---|
190 | this->setOrientation(Quaternion(Radian(0), Vector3(0, 1, 0))); |
---|
191 | } |
---|
192 | } |
---|
193 | |
---|
194 | } |
---|
195 | } |
---|
196 | |
---|
197 | //Change ability to move |
---|
198 | void PacmanGhost::changemovability(){ |
---|
199 | if(dontmove){ |
---|
200 | dontmove = false;} |
---|
201 | else{ |
---|
202 | dontmove = true; |
---|
203 | } |
---|
204 | } |
---|
205 | |
---|
206 | //ResetGhost |
---|
207 | void PacmanGhost::resetGhost(){ |
---|
208 | |
---|
209 | this->setPosition(this->resetposition); |
---|
210 | this->ismoving = false; |
---|
211 | this->actuelposition = this->getPosition(); |
---|
212 | |
---|
213 | this->target_x = actuelposition.x; |
---|
214 | this->target_z = actuelposition.z; |
---|
215 | |
---|
216 | } |
---|
217 | |
---|
218 | //Increase speed of ghosts |
---|
219 | void PacmanGhost::levelupvelo(){ |
---|
220 | speed ++; |
---|
221 | } |
---|
222 | |
---|
223 | Vector3 PacmanGhost::getPlayerPos() |
---|
224 | { |
---|
225 | for (PacmanGelb* player : ObjectList<PacmanGelb>()) |
---|
226 | { |
---|
227 | return player->getWorldPosition(); |
---|
228 | } |
---|
229 | //std::cout<<"bug ??"<<endl; |
---|
230 | return Vector3(0,0,0); //default, should not be used |
---|
231 | |
---|
232 | } |
---|
233 | |
---|
234 | |
---|
235 | bool PacmanGhost::jeanfindpos(Vector3 one, Vector3 other){ |
---|
236 | if((abs(one.x - other.x)<15) && (abs(one.y - other.y)<15) && (abs(one.z - other.z)<15)) return true; |
---|
237 | return false; |
---|
238 | } |
---|
239 | |
---|
240 | void PacmanGhost::setNewTargetGhost(Vector3 goalToGo){ |
---|
241 | |
---|
242 | this->target_x = goalToGo.x; |
---|
243 | this->target_z = goalToGo.z; |
---|
244 | this->ismoving = true; |
---|
245 | } |
---|
246 | |
---|
247 | |
---|
248 | /// |
---|
249 | //// getShortestPath ///////// |
---|
250 | /// |
---|
251 | |
---|
252 | |
---|
253 | |
---|
254 | Vector3 PacmanGhost::getShortestPath(Vector3 start, Vector3 goal, Vector3 pointToAvoidP1){ |
---|
255 | //this function should then somehow produce the algorithm and call all other functions |
---|
256 | //and finally return the best neighboor of the actual position of the pacman |
---|
257 | |
---|
258 | //(optional parameter) pointToAvoidP1 is a point that cannot be considered |
---|
259 | |
---|
260 | |
---|
261 | graphVertex listOfVerticesM[67]; //our list of all possible graphs |
---|
262 | graphVertex* actualVertex; //we will walk through the array with a pointer |
---|
263 | |
---|
264 | //vector<graphVertex> listOfVertices; |
---|
265 | |
---|
266 | |
---|
267 | if(start==goal){ // basic case |
---|
268 | return start; |
---|
269 | } |
---|
270 | |
---|
271 | for(int an=0; an < 67; an++){ |
---|
272 | listOfVerticesM[an]= graphVertex(possibleposition[an]); //same position order as in other file |
---|
273 | //listOfVertices.at(an) = graphVertex(possibleposition[an]); |
---|
274 | |
---|
275 | if(start==possibleposition[an]){ |
---|
276 | 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]; |
---|
282 | |
---|
283 | actualVertex->alreadyVisited=true; //our start point is now visited |
---|
284 | actualVertex->shortestDistanceToStart=0; //At our start point, distance from start is 0 |
---|
285 | findNeighboorVertices(actualVertex->position, actualVertex->adjacentVertices, listOfVerticesM); |
---|
286 | // second parameter is an array ! //third is our global array |
---|
287 | |
---|
288 | while(actualVertex->position!=goal){ |
---|
289 | for(int h=0;h < 4; h++){ |
---|
290 | if(actualVertex->adjacentVertices[h]!=nullptr){ //check all neighboors of our current graphVertex |
---|
291 | |
---|
292 | //h=2 and 3 never reached |
---|
293 | updateShortestDistanceToStart(*actualVertex, *actualVertex->adjacentVertices[h]); |
---|
294 | } //we "update" the neighboors of our new visited vertex |
---|
295 | |
---|
296 | } |
---|
297 | |
---|
298 | if(actualVertex==nullptr){ |
---|
299 | std::cout<<"Ornopdpde"<<endl; |
---|
300 | } |
---|
301 | |
---|
302 | actualVertex=findNextVertexToConsider(listOfVerticesM, pointToAvoidP1); |
---|
303 | actualVertex->alreadyVisited=true; |
---|
304 | //cout<<actualVertex->position<<endl; |
---|
305 | if(actualVertex->position!=goal){ |
---|
306 | findNeighboorVertices(actualVertex->position, actualVertex->adjacentVertices, listOfVerticesM); |
---|
307 | //we find the neighboors of our new visited vertex |
---|
308 | } |
---|
309 | } |
---|
310 | |
---|
311 | //cout<<"meuejeeke"<<endl; never reached |
---|
312 | |
---|
313 | //we should have reached our goal at this point |
---|
314 | |
---|
315 | while(actualVertex->actuelPredecessor->actuelPredecessor!=nullptr){ //the predecessor of our predecessor |
---|
316 | actualVertex=actualVertex->actuelPredecessor; |
---|
317 | } |
---|
318 | // the predecessor is our starting point, in other words we are now on an |
---|
319 | //adjacent vertex of the start |
---|
320 | |
---|
321 | return actualVertex->position; //we return the position of this - adjacent to start - vertex |
---|
322 | } |
---|
323 | |
---|
324 | //end of getShortestPath |
---|
325 | |
---|
326 | |
---|
327 | int PacmanGhost::graphDistance(Vector3 start, Vector3 goal){ |
---|
328 | //cout<<hgj++<<endl; |
---|
329 | Vector3 differenceVector= Vector3(abs(goal.x-start.x), 0,abs(goal.z-start.z)); |
---|
330 | |
---|
331 | return differenceVector.x+differenceVector.z; |
---|
332 | } |
---|
333 | |
---|
334 | void PacmanGhost::updateShortestDistanceToStart(graphVertex &vertex, graphVertex &neighboor){ |
---|
335 | //apply this method to all non visited neighboors of a vertex. |
---|
336 | // This method should always be run on a vertex after we marked it as visited. |
---|
337 | if(neighboor.alreadyVisited==false){ //we only consider non visited neighboors. |
---|
338 | if((vertex.shortestDistanceToStart!=std::numeric_limits<int>::max())&& |
---|
339 | (neighboor.shortestDistanceToStart > vertex.shortestDistanceToStart + |
---|
340 | graphDistance(vertex.position, neighboor.position))){ //need to consider overflow case ! |
---|
341 | |
---|
342 | neighboor.shortestDistanceToStart= vertex.shortestDistanceToStart + |
---|
343 | graphDistance(vertex.position, neighboor.position); |
---|
344 | neighboor.actuelPredecessor = &vertex; |
---|
345 | } |
---|
346 | } |
---|
347 | } |
---|
348 | |
---|
349 | void PacmanGhost::findNearestNonVisitedNeighboor (graphVertex &vertex, Vector3 pointToAvoidP3){ |
---|
350 | //find nearest non visited neighboor of a given already visited vertex |
---|
351 | //(optional parameter) pointToAvoidP3 is a point that cannot be considered |
---|
352 | int shortestDistance = -1; |
---|
353 | graphVertex* nearestNonVisitedNeighboor=nullptr;//=graphVertex(); //by default there is not any. |
---|
354 | //Also, if all neighboors are already visited, we return NULL, i.e. there is no |
---|
355 | //nearest non visited neighboor. |
---|
356 | for(int i=0; i < 4; i++){ |
---|
357 | if((vertex.adjacentVertices[i]!=nullptr)&&(vertex.adjacentVertices[i]->alreadyVisited==false)&&(vertex.adjacentVertices[i]->position!=pointToAvoidP3)){ |
---|
358 | if(shortestDistance==-1){ //(concerns line above) we want a non visited neighboor //(optional) if the position of the neighboor is the one we want |
---|
359 | //to avoid, then we ignore it |
---|
360 | |
---|
361 | shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position); |
---|
362 | nearestNonVisitedNeighboor=vertex.adjacentVertices[i]; //warning, both sides are pointer adresses ! |
---|
363 | //cout<<shortestDistance<<endl; |
---|
364 | } |
---|
365 | else if(graphDistance(vertex.position, vertex.adjacentVertices[i]->position)<shortestDistance){ |
---|
366 | shortestDistance= graphDistance(vertex.position, vertex.adjacentVertices[i]->position); |
---|
367 | nearestNonVisitedNeighboor=vertex.adjacentVertices[i]; //warning, both sides are pointer adresses ! |
---|
368 | //cout<<(hgj++)%4<<endl; |
---|
369 | } |
---|
370 | } |
---|
371 | } |
---|
372 | vertex.currentNearestNonVisitedNeighboor = nearestNonVisitedNeighboor; //warning, both sides are pointer adresses ! |
---|
373 | //cout<<hgj++<<endl; |
---|
374 | } |
---|
375 | |
---|
376 | |
---|
377 | PacmanGhost::graphVertex* PacmanGhost::findNextVertexToConsider(graphVertex listOfVerticesP[], Vector3 pointToAvoidP2){ //find next, nearest from start, non visited vertex in our listOfVertices array |
---|
378 | //(optional parameter) pointToAvoidP2 is a point that cannot be considered |
---|
379 | |
---|
380 | int shortestDistance = -1; |
---|
381 | graphVertex* nextVertexToConsider; |
---|
382 | |
---|
383 | for(int i=0; i < 67; i++){ //we loop over all possible positions |
---|
384 | |
---|
385 | if(listOfVerticesP[i].alreadyVisited==true){ //vertex should already be visited |
---|
386 | |
---|
387 | findNearestNonVisitedNeighboor(listOfVerticesP[i], pointToAvoidP2); //we update nearest neighboor |
---|
388 | //of all visited vertices given that one of the nearest neighboor of a visited |
---|
389 | // vertex is now also visited because it was chosen as next optimal vertex |
---|
390 | |
---|
391 | if(listOfVerticesP[i].currentNearestNonVisitedNeighboor!=nullptr){ //we want a candidate! |
---|
392 | if(shortestDistance==-1){ //our first possible candidate |
---|
393 | |
---|
394 | shortestDistance=graphDistance(listOfVerticesP[i].position, |
---|
395 | listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + |
---|
396 | listOfVerticesP[i].shortestDistanceToStart; |
---|
397 | |
---|
398 | nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor; |
---|
399 | //adress of nextVertexToConsider is that of pointer currentNearestNonVisitedNeighboor |
---|
400 | |
---|
401 | } |
---|
402 | else if(shortestDistance > graphDistance(listOfVerticesP[i].position, |
---|
403 | listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + |
---|
404 | listOfVerticesP[i].shortestDistanceToStart){//if better candidate than our first candidate available |
---|
405 | |
---|
406 | shortestDistance=graphDistance(listOfVerticesP[i].position, |
---|
407 | listOfVerticesP[i].currentNearestNonVisitedNeighboor->position) + |
---|
408 | listOfVerticesP[i].shortestDistanceToStart; |
---|
409 | |
---|
410 | nextVertexToConsider=listOfVerticesP[i].currentNearestNonVisitedNeighboor; |
---|
411 | //we dont need the & because we are not giving the adress of the array element |
---|
412 | //listOfVerticesP[i] but that of the pointer currentNearestNonVisitedNeighboor |
---|
413 | } |
---|
414 | } |
---|
415 | } |
---|
416 | //we want after all to return the nearest non visited neighboor |
---|
417 | } |
---|
418 | |
---|
419 | return nextVertexToConsider; //returns adress nextVertexToConsider is pointing to in array |
---|
420 | } |
---|
421 | |
---|
422 | ////////////////////////////////////////////////////////////////////////////////////////////// |
---|
423 | |
---|
424 | //-215 -185 -135 -70 -20 0 20 70 135 185 215 |
---|
425 | |
---|
426 | //-195 -135 -85 -35 15 60 105 150 195 245 |
---|
427 | |
---|
428 | void PacmanGhost::findNeighboorVertices(Vector3 actuelposition, graphVertex* adjacentVertices[], graphVertex listOfVerticesP2[]){ |
---|
429 | |
---|
430 | |
---|
431 | 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 ? |
---|
437 | } |
---|
438 | else if(findpos(actuelposition,possibleposition[1])){ |
---|
439 | adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]); |
---|
440 | adjacentVertices[1]=&listOfVerticesP2[2]; //graphVertex(possibleposition[2]); |
---|
441 | } |
---|
442 | else if(findpos(actuelposition,possibleposition[2])){ |
---|
443 | adjacentVertices[0]=&listOfVerticesP2[1]; //graphVertex(possibleposition[1]); |
---|
444 | adjacentVertices[1]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]); |
---|
445 | } |
---|
446 | 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]); |
---|
450 | } |
---|
451 | else if(findpos(actuelposition,possibleposition[4])){ |
---|
452 | adjacentVertices[0]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]); |
---|
453 | adjacentVertices[1]=&listOfVerticesP2[6]; //graphVertex(possibleposition[6]); |
---|
454 | } |
---|
455 | else if(findpos(actuelposition,possibleposition[5])){ |
---|
456 | adjacentVertices[0]=&listOfVerticesP2[3]; //graphVertex(possibleposition[3]); |
---|
457 | adjacentVertices[1]=&listOfVerticesP2[7]; //graphVertex(possibleposition[7]); |
---|
458 | } |
---|
459 | 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]); |
---|
463 | } |
---|
464 | else if(findpos(actuelposition,possibleposition[7])){ |
---|
465 | adjacentVertices[0]=&listOfVerticesP2[5]; //graphVertex(possibleposition[5]); |
---|
466 | adjacentVertices[1]=&listOfVerticesP2[8]; //graphVertex(possibleposition[8]); |
---|
467 | } |
---|
468 | else if(findpos(actuelposition,possibleposition[8])){ |
---|
469 | adjacentVertices[0]=&listOfVerticesP2[7]; //graphVertex(possibleposition[7]); |
---|
470 | adjacentVertices[1]=&listOfVerticesP2[9]; //graphVertex(possibleposition[9]); |
---|
471 | } |
---|
472 | 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]); |
---|
477 | } |
---|
478 | 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]); |
---|
482 | } |
---|
483 | 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]); |
---|
487 | } |
---|
488 | else if(findpos(actuelposition,possibleposition[12])){ |
---|
489 | adjacentVertices[0]=&listOfVerticesP2[11]; //graphVertex(possibleposition[11]); |
---|
490 | adjacentVertices[1]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]); |
---|
491 | } |
---|
492 | 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]); |
---|
497 | } |
---|
498 | 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]); |
---|
502 | } |
---|
503 | else if(findpos(actuelposition,possibleposition[15])){ |
---|
504 | adjacentVertices[0]=&listOfVerticesP2[14]; //graphVertex(possibleposition[14]); |
---|
505 | adjacentVertices[1]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]); |
---|
506 | } |
---|
507 | 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]); |
---|
511 | } |
---|
512 | else if(findpos(actuelposition,possibleposition[17])){ |
---|
513 | adjacentVertices[0]=&listOfVerticesP2[0]; //graphVertex(possibleposition[0]); |
---|
514 | adjacentVertices[1]=&listOfVerticesP2[25]; //graphVertex(possibleposition[25]); |
---|
515 | } |
---|
516 | else if(findpos(actuelposition,possibleposition[18])){ |
---|
517 | adjacentVertices[0]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]); |
---|
518 | adjacentVertices[1]=&listOfVerticesP2[24]; //graphVertex(possibleposition[24]); |
---|
519 | } |
---|
520 | 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]); |
---|
524 | } |
---|
525 | else if(findpos(actuelposition,possibleposition[20])){ |
---|
526 | adjacentVertices[0]=&listOfVerticesP2[19]; //graphVertex(possibleposition[19]); |
---|
527 | adjacentVertices[1]=&listOfVerticesP2[21]; //graphVertex(possibleposition[21]); |
---|
528 | } |
---|
529 | else if(findpos(actuelposition,possibleposition[21])){ |
---|
530 | adjacentVertices[0]=&listOfVerticesP2[20]; //graphVertex(possibleposition[20]); |
---|
531 | adjacentVertices[1]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]); |
---|
532 | } |
---|
533 | 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]); |
---|
537 | } |
---|
538 | else if(findpos(actuelposition,possibleposition[23])){ |
---|
539 | adjacentVertices[0]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]); |
---|
540 | adjacentVertices[1]=&listOfVerticesP2[30]; //graphVertex(possibleposition[30]); |
---|
541 | } |
---|
542 | else if(findpos(actuelposition,possibleposition[24])){ |
---|
543 | adjacentVertices[0]=&listOfVerticesP2[18]; //graphVertex(possibleposition[18]); |
---|
544 | adjacentVertices[1]=&listOfVerticesP2[29]; //graphVertex(possibleposition[29]); |
---|
545 | } |
---|
546 | else if(findpos(actuelposition,possibleposition[25])){ |
---|
547 | adjacentVertices[0]=&listOfVerticesP2[17]; //graphVertex(possibleposition[17]); |
---|
548 | adjacentVertices[1]=&listOfVerticesP2[26]; //graphVertex(possibleposition[26]); |
---|
549 | } |
---|
550 | 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]); |
---|
554 | } |
---|
555 | 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]); |
---|
559 | } |
---|
560 | 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]); |
---|
564 | } |
---|
565 | 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]); |
---|
569 | } |
---|
570 | 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]); |
---|
574 | } |
---|
575 | else if(findpos(actuelposition,possibleposition[31])){ |
---|
576 | adjacentVertices[0]=&listOfVerticesP2[22]; //graphVertex(possibleposition[22]); |
---|
577 | adjacentVertices[1]=&listOfVerticesP2[32]; //graphVertex(possibleposition[32]); |
---|
578 | } |
---|
579 | else if(findpos(actuelposition,possibleposition[32])){ |
---|
580 | adjacentVertices[0]=&listOfVerticesP2[31]; //graphVertex(possibleposition[31]); |
---|
581 | adjacentVertices[1]=&listOfVerticesP2[33]; //graphVertex(possibleposition[33]); |
---|
582 | } |
---|
583 | else if(findpos(actuelposition,possibleposition[33])){ |
---|
584 | adjacentVertices[0]=&listOfVerticesP2[32]; //graphVertex(possibleposition[32]); |
---|
585 | adjacentVertices[1]=&listOfVerticesP2[34]; //graphVertex(possibleposition[34]); |
---|
586 | } |
---|
587 | 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]); |
---|
592 | |
---|
593 | } |
---|
594 | 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]); |
---|
598 | } |
---|
599 | else if(findpos(actuelposition,possibleposition[36])){ |
---|
600 | adjacentVertices[0]=&listOfVerticesP2[28]; //graphVertex(possibleposition[28]); |
---|
601 | adjacentVertices[1]=&listOfVerticesP2[35]; //graphVertex(possibleposition[35]); |
---|
602 | } |
---|
603 | else if(findpos(actuelposition,possibleposition[37])){ |
---|
604 | adjacentVertices[0]=&listOfVerticesP2[27]; //graphVertex(possibleposition[27]); |
---|
605 | adjacentVertices[1]=&listOfVerticesP2[38]; //graphVertex(possibleposition[38]); |
---|
606 | } |
---|
607 | 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]); |
---|
611 | } |
---|
612 | 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]); |
---|
616 | } |
---|
617 | else if(findpos(actuelposition,possibleposition[40])){ |
---|
618 | adjacentVertices[0]=&listOfVerticesP2[39]; //graphVertex(possibleposition[39]); |
---|
619 | adjacentVertices[1]=&listOfVerticesP2[41]; //graphVertex(possibleposition[41]); |
---|
620 | } |
---|
621 | 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 meuh |
---|
625 | } |
---|
626 | 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]); |
---|
630 | } |
---|
631 | 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 meuh |
---|
635 | } |
---|
636 | else if(findpos(actuelposition,possibleposition[44])){ |
---|
637 | adjacentVertices[0]=&listOfVerticesP2[40]; //graphVertex(possibleposition[40]); |
---|
638 | adjacentVertices[1]=&listOfVerticesP2[66]; //graphVertex(possibleposition[66]); |
---|
639 | } |
---|
640 | 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]); |
---|
644 | } |
---|
645 | else if(findpos(actuelposition,possibleposition[46])){ |
---|
646 | adjacentVertices[0]=&listOfVerticesP2[43]; //graphVertex(possibleposition[43]); |
---|
647 | adjacentVertices[1]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]); |
---|
648 | } |
---|
649 | 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]); |
---|
653 | } |
---|
654 | 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]); |
---|
658 | } |
---|
659 | else if(findpos(actuelposition,possibleposition[49])){ |
---|
660 | adjacentVertices[0]=&listOfVerticesP2[45]; //graphVertex(possibleposition[45]); |
---|
661 | adjacentVertices[1]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]); |
---|
662 | } |
---|
663 | else if(findpos(actuelposition,possibleposition[50])){ |
---|
664 | adjacentVertices[0]=&listOfVerticesP2[51]; //graphVertex(possibleposition[51]); |
---|
665 | adjacentVertices[1]=&listOfVerticesP2[61]; //graphVertex(possibleposition[61]); |
---|
666 | } |
---|
667 | else if(findpos(actuelposition,possibleposition[51])){ |
---|
668 | adjacentVertices[0]=&listOfVerticesP2[48]; //graphVertex(possibleposition[48]); |
---|
669 | adjacentVertices[1]=&listOfVerticesP2[50]; //graphVertex(possibleposition[50]); |
---|
670 | } |
---|
671 | else if(findpos(actuelposition,possibleposition[52])){ |
---|
672 | adjacentVertices[0]=&listOfVerticesP2[47]; //graphVertex(possibleposition[47]); |
---|
673 | adjacentVertices[1]=&listOfVerticesP2[53]; //graphVertex(possibleposition[53]); |
---|
674 | } |
---|
675 | else if(findpos(actuelposition,possibleposition[53])){ |
---|
676 | adjacentVertices[0]=&listOfVerticesP2[52]; //graphVertex(possibleposition[52]); |
---|
677 | adjacentVertices[1]=&listOfVerticesP2[58]; //graphVertex(possibleposition[58]); |
---|
678 | } |
---|
679 | 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]); |
---|
683 | } |
---|
684 | else if(findpos(actuelposition,possibleposition[55])){ |
---|
685 | adjacentVertices[0]=&listOfVerticesP2[54]; //graphVertex(possibleposition[54]); |
---|
686 | adjacentVertices[1]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]); |
---|
687 | } |
---|
688 | 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]); |
---|
692 | } |
---|
693 | 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]); |
---|
698 | |
---|
699 | } |
---|
700 | 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]); |
---|
704 | } |
---|
705 | 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]); |
---|
709 | } |
---|
710 | 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]); |
---|
714 | } |
---|
715 | 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]); |
---|
719 | } |
---|
720 | else if(findpos(actuelposition,possibleposition[62])){ |
---|
721 | adjacentVertices[0]=&listOfVerticesP2[16]; //graphVertex(possibleposition[16]); |
---|
722 | adjacentVertices[1]=&listOfVerticesP2[60]; //graphVertex(possibleposition[60]); |
---|
723 | } |
---|
724 | else if(findpos(actuelposition,possibleposition[63])){ |
---|
725 | adjacentVertices[0]=&listOfVerticesP2[59]; //graphVertex(possibleposition[59]); |
---|
726 | adjacentVertices[1]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]); |
---|
727 | } |
---|
728 | 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]); |
---|
732 | } |
---|
733 | else if(findpos(actuelposition,possibleposition[65])){ |
---|
734 | adjacentVertices[0]=&listOfVerticesP2[56]; //graphVertex(possibleposition[56]); |
---|
735 | adjacentVertices[1]=&listOfVerticesP2[64]; //graphVertex(possibleposition[64]); |
---|
736 | } |
---|
737 | 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 | |
---|
748 | |
---|
749 | |
---|
750 | Vector3 PacmanGhost::frontPosition(){ |
---|
751 | |
---|
752 | Vector3 neighborPos[4] = {Vector3(-1,-1,-1)}; |
---|
753 | Vector3 frontPoint = Vector3(0,-1,0); |
---|
754 | |
---|
755 | |
---|
756 | findNeighboorPositions(this->lastPlayerPassedPoint, neighborPos, possibleposition); |
---|
757 | |
---|
758 | for(int i=0; i<4; i++){ |
---|
759 | |
---|
760 | if((neighborPos[i]!=Vector3(-1,-1,-1))&&(neighborPos[i].y==10)){ |
---|
761 | //y==10 to ignore many unwanted strange positions that pop up otherwise and create SIGSEV |
---|
762 | |
---|
763 | if(frontPoint==Vector3(0,-1,0)){ |
---|
764 | frontPoint=neighborPos[i]; |
---|
765 | |
---|
766 | } |
---|
767 | else if (graphDistance(this->getPlayerPos(), frontPoint)>graphDistance(this->getPlayerPos(), neighborPos[i])){ |
---|
768 | frontPoint=neighborPos[i]; |
---|
769 | } |
---|
770 | |
---|
771 | } |
---|
772 | } |
---|
773 | |
---|
774 | if(frontPoint==Vector3(0,-1,0)){ |
---|
775 | //default |
---|
776 | return this->lastPlayerPassedPoint; |
---|
777 | } |
---|
778 | else{ |
---|
779 | //std::cout<<frontPoint<<endl; |
---|
780 | return frontPoint; |
---|
781 | } |
---|
782 | } |
---|
783 | |
---|
784 | |
---|
785 | |
---|
786 | |
---|
787 | |
---|
788 | |
---|
789 | void PacmanGhost::findNeighboorPositions(Vector3 actuelposition, Vector3 adjacentPositions[], Vector3 positionArray[]){ |
---|
790 | //this function should put in adjacentPosition[] the neighboors of lastPlayerPastPoint |
---|
791 | |
---|
792 | if(findpos(actuelposition,possibleposition[0])){ |
---|
793 | |
---|
794 | |
---|
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 ? |
---|
798 | } |
---|
799 | else if(findpos(actuelposition,possibleposition[1])){ |
---|
800 | adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]); |
---|
801 | adjacentPositions[1]=positionArray[2]; //graphVertex(possibleposition[2]); |
---|
802 | } |
---|
803 | else if(findpos(actuelposition,possibleposition[2])){ |
---|
804 | adjacentPositions[0]=positionArray[1]; //graphVertex(possibleposition[1]); |
---|
805 | adjacentPositions[1]=positionArray[3]; //graphVertex(possibleposition[3]); |
---|
806 | } |
---|
807 | 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]); |
---|
811 | } |
---|
812 | else if(findpos(actuelposition,possibleposition[4])){ |
---|
813 | adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]); |
---|
814 | adjacentPositions[1]=positionArray[6]; //graphVertex(possibleposition[6]); |
---|
815 | } |
---|
816 | else if(findpos(actuelposition,possibleposition[5])){ |
---|
817 | adjacentPositions[0]=positionArray[3]; //graphVertex(possibleposition[3]); |
---|
818 | adjacentPositions[1]=positionArray[7]; //graphVertex(possibleposition[7]); |
---|
819 | } |
---|
820 | 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]); |
---|
824 | } |
---|
825 | else if(findpos(actuelposition,possibleposition[7])){ |
---|
826 | adjacentPositions[0]=positionArray[5]; //graphVertex(possibleposition[5]); |
---|
827 | adjacentPositions[1]=positionArray[8]; //graphVertex(possibleposition[8]); |
---|
828 | } |
---|
829 | else if(findpos(actuelposition,possibleposition[8])){ |
---|
830 | adjacentPositions[0]=positionArray[7]; //graphVertex(possibleposition[7]); |
---|
831 | adjacentPositions[1]=positionArray[9]; //graphVertex(possibleposition[9]); |
---|
832 | } |
---|
833 | 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]); |
---|
838 | } |
---|
839 | 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]); |
---|
843 | } |
---|
844 | 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]); |
---|
848 | } |
---|
849 | else if(findpos(actuelposition,possibleposition[12])){ |
---|
850 | adjacentPositions[0]=positionArray[11]; //graphVertex(possibleposition[11]); |
---|
851 | adjacentPositions[1]=positionArray[14]; //graphVertex(possibleposition[14]); |
---|
852 | } |
---|
853 | 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]); |
---|
858 | } |
---|
859 | 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]); |
---|
863 | } |
---|
864 | else if(findpos(actuelposition,possibleposition[15])){ |
---|
865 | adjacentPositions[0]=positionArray[14]; //graphVertex(possibleposition[14]); |
---|
866 | adjacentPositions[1]=positionArray[16]; //graphVertex(possibleposition[16]); |
---|
867 | } |
---|
868 | 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]); |
---|
872 | } |
---|
873 | else if(findpos(actuelposition,possibleposition[17])){ |
---|
874 | adjacentPositions[0]=positionArray[0]; //graphVertex(possibleposition[0]); |
---|
875 | adjacentPositions[1]=positionArray[25]; //graphVertex(possibleposition[25]); |
---|
876 | } |
---|
877 | else if(findpos(actuelposition,possibleposition[18])){ |
---|
878 | adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]); |
---|
879 | adjacentPositions[1]=positionArray[24]; //graphVertex(possibleposition[24]); |
---|
880 | } |
---|
881 | 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]); |
---|
885 | } |
---|
886 | else if(findpos(actuelposition,possibleposition[20])){ |
---|
887 | adjacentPositions[0]=positionArray[19]; //graphVertex(possibleposition[19]); |
---|
888 | adjacentPositions[1]=positionArray[21]; //graphVertex(possibleposition[21]); |
---|
889 | } |
---|
890 | else if(findpos(actuelposition,possibleposition[21])){ |
---|
891 | adjacentPositions[0]=positionArray[20]; //graphVertex(possibleposition[20]); |
---|
892 | adjacentPositions[1]=positionArray[22]; //graphVertex(possibleposition[22]); |
---|
893 | } |
---|
894 | 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]); |
---|
898 | } |
---|
899 | else if(findpos(actuelposition,possibleposition[23])){ |
---|
900 | adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]); |
---|
901 | adjacentPositions[1]=positionArray[30]; //graphVertex(possibleposition[30]); |
---|
902 | } |
---|
903 | else if(findpos(actuelposition,possibleposition[24])){ |
---|
904 | adjacentPositions[0]=positionArray[18]; //graphVertex(possibleposition[18]); |
---|
905 | adjacentPositions[1]=positionArray[29]; //graphVertex(possibleposition[29]); |
---|
906 | } |
---|
907 | else if(findpos(actuelposition,possibleposition[25])){ |
---|
908 | adjacentPositions[0]=positionArray[17]; //graphVertex(possibleposition[17]); |
---|
909 | adjacentPositions[1]=positionArray[26]; //graphVertex(possibleposition[26]); |
---|
910 | } |
---|
911 | 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]); |
---|
915 | } |
---|
916 | 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]); |
---|
920 | } |
---|
921 | 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]); |
---|
925 | } |
---|
926 | 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]); |
---|
930 | } |
---|
931 | 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]); |
---|
935 | } |
---|
936 | else if(findpos(actuelposition,possibleposition[31])){ |
---|
937 | adjacentPositions[0]=positionArray[22]; //graphVertex(possibleposition[22]); |
---|
938 | adjacentPositions[1]=positionArray[32]; //graphVertex(possibleposition[32]); |
---|
939 | } |
---|
940 | else if(findpos(actuelposition,possibleposition[32])){ |
---|
941 | adjacentPositions[0]=positionArray[31]; //graphVertex(possibleposition[31]); |
---|
942 | adjacentPositions[1]=positionArray[33]; //graphVertex(possibleposition[33]); |
---|
943 | } |
---|
944 | else if(findpos(actuelposition,possibleposition[33])){ |
---|
945 | adjacentPositions[0]=positionArray[32]; //graphVertex(possibleposition[32]); |
---|
946 | adjacentPositions[1]=positionArray[34]; //graphVertex(possibleposition[34]); |
---|
947 | } |
---|
948 | 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]); |
---|
953 | |
---|
954 | } |
---|
955 | 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]); |
---|
959 | } |
---|
960 | else if(findpos(actuelposition,possibleposition[36])){ |
---|
961 | adjacentPositions[0]=positionArray[28]; //graphVertex(possibleposition[28]); |
---|
962 | adjacentPositions[1]=positionArray[35]; //graphVertex(possibleposition[35]); |
---|
963 | } |
---|
964 | else if(findpos(actuelposition,possibleposition[37])){ |
---|
965 | adjacentPositions[0]=positionArray[27]; //graphVertex(possibleposition[27]); |
---|
966 | adjacentPositions[1]=positionArray[38]; //graphVertex(possibleposition[38]); |
---|
967 | } |
---|
968 | 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]); |
---|
972 | } |
---|
973 | 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]); |
---|
977 | } |
---|
978 | else if(findpos(actuelposition,possibleposition[40])){ |
---|
979 | adjacentPositions[0]=positionArray[39]; //graphVertex(possibleposition[39]); |
---|
980 | adjacentPositions[1]=positionArray[41]; //graphVertex(possibleposition[41]); |
---|
981 | } |
---|
982 | 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]; //error |
---|
986 | } |
---|
987 | 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]); |
---|
991 | } |
---|
992 | 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]; //error |
---|
996 | } |
---|
997 | else if(findpos(actuelposition,possibleposition[44])){ |
---|
998 | adjacentPositions[0]=positionArray[40]; //graphVertex(possibleposition[40]); |
---|
999 | adjacentPositions[1]=positionArray[66]; //graphVertex(possibleposition[66]); |
---|
1000 | } |
---|
1001 | 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]); |
---|
1005 | } |
---|
1006 | else if(findpos(actuelposition,possibleposition[46])){ |
---|
1007 | adjacentPositions[0]=positionArray[43]; //graphVertex(possibleposition[43]); |
---|
1008 | adjacentPositions[1]=positionArray[47]; //graphVertex(possibleposition[47]); |
---|
1009 | } |
---|
1010 | 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]); |
---|
1014 | } |
---|
1015 | 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]); |
---|
1019 | } |
---|
1020 | else if(findpos(actuelposition,possibleposition[49])){ |
---|
1021 | adjacentPositions[0]=positionArray[45]; //graphVertex(possibleposition[45]); |
---|
1022 | adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]); |
---|
1023 | } |
---|
1024 | else if(findpos(actuelposition,possibleposition[50])){ |
---|
1025 | adjacentPositions[0]=positionArray[51]; //graphVertex(possibleposition[51]); |
---|
1026 | adjacentPositions[1]=positionArray[61]; //graphVertex(possibleposition[61]); |
---|
1027 | } |
---|
1028 | else if(findpos(actuelposition,possibleposition[51])){ |
---|
1029 | adjacentPositions[0]=positionArray[48]; //graphVertex(possibleposition[48]); |
---|
1030 | adjacentPositions[1]=positionArray[50]; //graphVertex(possibleposition[50]); |
---|
1031 | } |
---|
1032 | else if(findpos(actuelposition,possibleposition[52])){ |
---|
1033 | adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]); |
---|
1034 | adjacentPositions[1]=positionArray[53]; //graphVertex(possibleposition[53]); |
---|
1035 | } |
---|
1036 | else if(findpos(actuelposition,possibleposition[53])){ |
---|
1037 | adjacentPositions[0]=positionArray[52]; //graphVertex(possibleposition[52]); |
---|
1038 | adjacentPositions[1]=positionArray[58]; //graphVertex(possibleposition[58]); |
---|
1039 | } |
---|
1040 | 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]); |
---|
1044 | } |
---|
1045 | else if(findpos(actuelposition,possibleposition[55])){ |
---|
1046 | adjacentPositions[0]=positionArray[54]; //graphVertex(possibleposition[54]); |
---|
1047 | adjacentPositions[1]=positionArray[56]; //graphVertex(possibleposition[56]); |
---|
1048 | } |
---|
1049 | 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]); |
---|
1053 | } |
---|
1054 | 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]); |
---|
1059 | |
---|
1060 | } |
---|
1061 | 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]); |
---|
1065 | } |
---|
1066 | else if(findpos(actuelposition,possibleposition[59])){ |
---|
1067 | adjacentPositions[0]=positionArray[58]; //graphVertex(possibleposition[58]); |
---|
1068 | adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]); //error 59 |
---|
1069 | adjacentPositions[2]=positionArray[63]; //graphVertex(possibleposition[63]); |
---|
1070 | } |
---|
1071 | 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]); |
---|
1075 | } |
---|
1076 | 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]); |
---|
1080 | } |
---|
1081 | else if(findpos(actuelposition,possibleposition[62])){ |
---|
1082 | adjacentPositions[0]=positionArray[16]; //graphVertex(possibleposition[16]); |
---|
1083 | adjacentPositions[1]=positionArray[60]; //graphVertex(possibleposition[60]); |
---|
1084 | } |
---|
1085 | else if(findpos(actuelposition,possibleposition[63])){ |
---|
1086 | adjacentPositions[0]=positionArray[59]; //graphVertex(possibleposition[59]); |
---|
1087 | adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]); |
---|
1088 | } |
---|
1089 | 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]); |
---|
1093 | } |
---|
1094 | else if(findpos(actuelposition,possibleposition[65])){ |
---|
1095 | adjacentPositions[0]=positionArray[56]; //graphVertex(possibleposition[56]); |
---|
1096 | adjacentPositions[1]=positionArray[64]; //graphVertex(possibleposition[64]); |
---|
1097 | } |
---|
1098 | else if(findpos(actuelposition,possibleposition[66])){ |
---|
1099 | adjacentPositions[0]=positionArray[47]; //graphVertex(possibleposition[47]); |
---|
1100 | adjacentPositions[1]=positionArray[48]; //graphVertex(possibleposition[48]); |
---|
1101 | } |
---|
1102 | } |
---|
1103 | |
---|
1104 | |
---|
1105 | } |
---|