Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/3DPacman_FS19/src/modules/pacman/PacmanPink.cc @ 12304

Last change on this file since 12304 was 12304, checked in by peterf, 5 years ago

added several pacmans

File size: 24.4 KB
Line 
1       
2#include "PacmanPink.h"
3
4#include "core/CoreIncludes.h"
5#include "BulletDynamics/Dynamics/btRigidBody.h"
6
7       
8namespace orxonox{
9
10        RegisterClass(PacmanPink);
11
12                PacmanPink::PacmanPink(Context* context) : PacmanGhost(context){
13
14        RegisterObject(PacmanPink);
15         
16    }
17
18    /**
19    @brief
20        Method for creating a ghost through XML.
21    */
22    void PacmanPink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
23    {
24        SUPER(PacmanPink, XMLPort, xmlelement, mode);
25    }
26
27
28    void PacmanPink::tick(float dt)
29    {
30        SUPER(PacmanGhost, tick, dt);
31
32        this->actuelposition = this->getPosition();
33       
34        //Stop, if target arrived
35        if((abs(this->actuelposition.x - this->target_x)<0.5) && (abs(this->actuelposition.z - this->target_z)<0.5)){
36                 this->ismoving = false;
37        }
38
39        //Move, if ghost hasn't arrived yet
40        if(this->ismoving){
41            if(!(abs(this->actuelposition.z-target_z)<0.5)) {
42                velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
43                move(dt, actuelposition, velocity);
44            }   
45            if(!(abs(this->actuelposition.x-target_x)<0.5)){
46                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
47                move(dt, actuelposition, velocity);
48            }
49        }
50        //Check on which position the ghost has arrived and set new target
51         else{
52            while(lockmove){};
53            lockmove = true;
54
55            if(findPos(player.getPos(), player.lastPassedPoint)){
56                // if player is on a point, for simplicity go to it
57            Vector3 nextMove = getShortestPath(this->actuelposition, player.lastPassedPoint);
58            setNewTargetPink(nextMove);
59            }
60
61            else{ //if player is not on a point either go to next neighboor, or if no
62            //neighboor in player direction available, go to last point passed by player.
63
64            int dir=findPlayerTravDir(player.lastPassedPoint, player.getPos());
65            //not in other sense!
66
67            Vector3[] neighboors;
68            findNeighboor(player.lastPassedPoint, neighboors);
69            //we need to create function that finds neighboors of player last point
70            //We can use and even should use the part of the tick random function
71            // that determines the neighboors. But array neighboor should be in form
72            // south-west-north-east respectively to array index.
73
74            for(int s=0; s < 4; s++){
75                //find next neighboor between player and player.lastPassedPoint
76                if((neighboors[s]!=NULL)&&(s==dir)){
77                        if(dir==0){
78                                Vector3 nextMove=getShortestPath(this->actuelposition, neighboors[s]);
79                                setNewTargetPink(nextMove);
80                        }
81                        else if(dir==1){
82                                Vector3 nextMove=getShortestPath(this->actuelposition, neighboors[s]);
83                                setNewTargetPink(nextMove);
84                        }
85                        else if(dir==2){
86                                Vector3 nextMove=getShortestPath(this->actuelposition, neighboors[s]);
87                                setNewTargetPink(nextMove);
88                        }
89                        else{//last is default
90                                Vector3 nextMove=getShortestPath(this->actuelposition, neighboors[s]);
91                                setNewTargetPink(nextMove);
92                                        }
93                        }
94                else{//if no further point after last player point possible
95                        //then simply go to this last point.
96                Vector3 nextMove=getShortestPath(this->actuelposition, player.lastPassedPoint);
97                        setNewTargetPink(nextMove);
98                        }
99
100                }
101
102            }
103
104        }
105
106
107
108       
109        Vector3 diffVector (Vector3 start, Vector3 goal){
110
111                Vector3 result;
112                result.x=goal.x-start.x;
113                result.z=goal.z-start.z;
114                return result;
115        }
116
117        int findPlayerTravDir (Vector3 playerPosBefore, Vector3 playerPos){
118                //return 0 for south, 1 for west, 2 for north, 3 for east
119
120                Vector3 difference = diffVector(playerPosBefore, playerPos);
121
122
123                if((difference.z < 0)&&(difference.z>difference.x)){ //move south
124
125                        return 0;
126                }
127                else if((difference.x < 0)&&(difference.x > difference.z )){//move west
128
129                        return 1;
130                }
131
132                else if((difference.z>0)&&(difference.z>difference.x)){ //mouve north
133
134                        return 2;
135                }
136
137                else if((difference.x>0)&&(difference.x>difference.z)){ //move east
138                        return 3;
139
140                }
141
142                else { //default move west
143
144                return 1;
145                }
146               
147
148        Vector3 getPointInFrontOfPacman(Vector3 pacLasVisPos,int indexForSWNE){
149                //return the Vector3 point that Pinky should target to
150                //be in front of pacman
151
152                Vector3 listOfNeighboors[4];
153                //first element is south, 2nd west, 3d north, 4th east
154
155                /*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
156        Vector3(185,10,150),Vector3(135,10,150),Vector3(215,10,150),Vector3(215,10,105),Vector3(135,10,105), //5-9
157        Vector3(135,10,15),Vector3(135,10,-85),Vector3(215,10,-85),Vector3(135,10,-135),Vector3(215,10,-135), //10-14
158        Vector3(215,10,-195),Vector3(135,10,-195),Vector3(20,10,195),Vector3(-20,10,195),Vector3(-20,10,245), //15-19
159        Vector3(-215,10,245),Vector3(-215,10,195),Vector3(-185,10,195),Vector3(-135,10,195),Vector3(-70,10,195), //20-24
160        Vector3(70,10,195),Vector3(70,10,150),Vector3(20,10,150),Vector3(-20,10,150),Vector3(-70,10,150), //25-29
161        Vector3(-135,10,150),Vector3(-185,10,150),Vector3(-215,10,150),Vector3(-215,10,105),Vector3(-135,10,105), //30-34
162        Vector3(-70,10,105),Vector3(-20,10,105),Vector3(20,10,105),Vector3(70,10,105),Vector3(70,10,60), //35-39
163        Vector3(0,10,60),Vector3(-70,10,60),Vector3(-135,10,15),Vector3(-70,10,60),Vector3(0,10,15), //40-44
164        Vector3(70,10,15),Vector3(-70,10,-35),Vector3(-20,10,-35),Vector3(20,10,-35),Vector3(70,10,-35), //45-49
165        Vector3(70,10,-85),Vector3(20,10,-85),Vector3(-20,10,-85),Vector3(-70,10,-85),Vector3(-135,10,-85), //50-54
166        Vector3(-215,10,-85),Vector3(-215,10,-135),Vector3(-135,10,-135),Vector3(-70,10,-135),Vector3(-20,10,-135), //55-59
167        Vector3(20,10,-135),Vector3(70,10,-135),Vector3(20,10,-195),Vector3(-20,10,-195),Vector3(-135,10,-195), //60-64
168        Vector3(-215,10,-195),Vector3(0,10,-35)}; //65-66*/
169
170
171
172
173                if(findpos(pacLasVisPos,possibleposition[0])){
174                        //no south neighbor
175                        listOfNeighboors[1]=possibleposition[19]; // west neighbor
176                        listOfNeighboors[2]=possibleposition[17]; //north
177                        listOfNeighboors[3]=possibleposition[1]; //east
178                        return listOfNeighboors[s];
179            }
180            else if(findpos(pacLasVisPos,possibleposition[1])){
181                listOfNeighboors[1]=possibleposition[0]; // west neighbor
182                        listOfNeighboors[2]=possibleposition[2]; //north
183                        return listOfNeighboors[s];
184            }
185            else if(findpos(pacLasVisPos,possibleposition[2])){
186                listOfNeighboors[0]=possibleposition[1];  //south
187                listOfNeighboors[1]=possibleposition[3]; //west
188                        return listOfNeighboors[s];
189            }
190            else if(findpos(pacLasVisPos,possibleposition[3])){
191                listOfNeighboors[1]=possibleposition[4]; //west
192                        listOfNeighboors[2]=possibleposition[5]; //north
193                        listOfNeighboors[3]=possibleposition[2]; //east
194                        return listOfNeighboors[s];
195            }
196            else if(findpos(pacLasVisPos,possibleposition[4])){
197                        listOfNeighboors[2]=possibleposition[6]; //north
198                        listOfNeighboors[3]=possibleposition[3]; //east
199                        return listOfNeighboors[s];
200            }
201            else if(findpos(pacLasVisPos,possibleposition[5])){
202                listOfNeighboors[0]=possibleposition[3]; //south
203                        listOfNeighboors[3]=possibleposition[7]; //east
204                        return listOfNeighboors[s];
205            }
206            else if(findpos(pacLasVisPos,possibleposition[6])){
207                listOfNeighboors[0]=possibleposition[4]; //south
208                listOfNeighboors[1]=possibleposition[26]; //west
209                        listOfNeighboors[2]=possibleposition[9]; //north
210                        return listOfNeighboors[s];
211            }
212            else if(findpos(pacLasVisPos,possibleposition[7])){
213                listOfNeighboors[1]=possibleposition[5]; //west
214                        listOfNeighboors[2]=possibleposition[8]; //north
215                        return listOfNeighboors[s];
216            }
217            else if(findpos(pacLasVisPos,possibleposition[8])){
218                listOfNeighboors[0]=possibleposition[7]; //south
219                listOfNeighboors[1]=possibleposition[9]; //west
220                        return listOfNeighboors[s];
221            }
222            else if(findpos(pacLasVisPos,possibleposition[9])){
223                listOfNeighboors[0]=possibleposition[6]; //south
224                listOfNeighboors[1]=possibleposition[38]; //west
225                        listOfNeighboors[2]=possibleposition[10]; //north
226                        listOfNeighboors[3]=possibleposition[8]; //east
227                        return listOfNeighboors[s];
228            }
229            else if(findpos(pacLasVisPos,possibleposition[10])){
230                listOfNeighboors[0]=possibleposition[9]; //south
231                listOfNeighboors[1]=possibleposition[45]; //west
232                        listOfNeighboors[2]=possibleposition[11]; //north
233                        return listOfNeighboors[s];
234            }
235            else if(findpos(pacLasVisPos,possibleposition[11])){
236                listOfNeighboors[0]=possibleposition[10]; //south
237                        listOfNeighboors[2]=possibleposition[13]; //north
238                        listOfNeighboors[3]=possibleposition[12]; //east
239                        return listOfNeighboors[s];
240            }
241            else if(findpos(pacLasVisPos,possibleposition[12])){
242                listOfNeighboors[1]=possibleposition[11]; //west
243                        listOfNeighboors[2]=possibleposition[14]; //north
244                        return listOfNeighboors[s];
245            }
246            else if(findpos(pacLasVisPos,possibleposition[13])){
247                listOfNeighboors[0]=possibleposition[11]; //south
248                listOfNeighboors[1]=possibleposition[61]; //west
249                        listOfNeighboors[2]=possibleposition[16]; //north
250                        listOfNeighboors[3]=possibleposition[14]; //east
251                        return listOfNeighboors[s];
252            }
253            else if(findpos(pacLasVisPos,possibleposition[14])){
254                listOfNeighboors[0]=possibleposition[12]; //south
255                listOfNeighboors[1]=possibleposition[13]; //west
256                        listOfNeighboors[2]=possibleposition[15]; //north
257                        return listOfNeighboors[s];
258            }
259            else if(findpos(pacLasVisPos,possibleposition[15])){
260                listOfNeighboors[0]=possibleposition[14]; //south
261                listOfNeighboors[1]=possibleposition[16]; //west
262                        return listOfNeighboors[s];
263            }
264            else if(findpos(pacLasVisPos,possibleposition[16])){
265                listOfNeighboors[0]=possibleposition[13]; //south
266                listOfNeighboors[1]=possibleposition[62]; //west
267                        listOfNeighboors[2]=possibleposition[15]; //north
268                        return listOfNeighboors[s];
269            }
270            else if(findpos(pacLasVisPos,possibleposition[17])){
271                listOfNeighboors[0]=possibleposition[0]; //south
272                        listOfNeighboors[3]=possibleposition[25]; //east
273                        return listOfNeighboors[s];
274            }
275            else if(findpos(pacLasVisPos,possibleposition[18])){
276                listOfNeighboors[0]=possibleposition[19]; //south
277                listOfNeighboors[1]=possibleposition[24]; //west
278                        return listOfNeighboors[s];
279            }
280            else if(findpos(pacLasVisPos,possibleposition[19])){
281                listOfNeighboors[1]=possibleposition[20]; //west
282                        listOfNeighboors[2]=possibleposition[18]; //north
283                        listOfNeighboors[3]=possibleposition[0]; //east
284                        return listOfNeighboors[s];
285            }
286            else if(findpos(pacLasVisPos,possibleposition[20])){
287                        listOfNeighboors[2]=possibleposition[21]; //north
288                        listOfNeighboors[3]=possibleposition[19]; //east
289                        return listOfNeighboors[s];
290            }
291            else if(findpos(pacLasVisPos,possibleposition[21])){
292                listOfNeighboors[0]=possibleposition[20]; //south
293                        listOfNeighboors[3]=possibleposition[22]; //east
294                        return listOfNeighboors[s];
295            }
296            else if(findpos(pacLasVisPos,possibleposition[22])){
297                listOfNeighboors[1]=possibleposition[21]; //west
298                        listOfNeighboors[2]=possibleposition[31]; //north
299                        listOfNeighboors[3]=possibleposition[23]; //east
300                        return listOfNeighboors[s];
301            }
302            else if(findpos(pacLasVisPos,possibleposition[23])){
303                listOfNeighboors[1]=possibleposition[22]; //west
304                        listOfNeighboors[2]=possibleposition[30]; //north
305                        return listOfNeighboors[s];
306            }
307            else if(findpos(pacLasVisPos,possibleposition[24])){
308                        listOfNeighboors[2]=possibleposition[29]; //north
309                        listOfNeighboors[3]=possibleposition[18]; //east
310                        return listOfNeighboors[s];
311            }
312            else if(findpos(pacLasVisPos,possibleposition[25])){
313                listOfNeighboors[1]=possibleposition[17]; //west
314                        listOfNeighboors[2]=possibleposition[26]; //north
315                        return listOfNeighboors[s];
316            }
317            else if(findpos(pacLasVisPos,possibleposition[26])){
318                listOfNeighboors[0]=possibleposition[25]; //south
319                listOfNeighboors[1]=possibleposition[27]; //west
320                        listOfNeighboors[3]=possibleposition[6]; //east
321                        return listOfNeighboors[s];
322            }
323            else if(findpos(pacLasVisPos,possibleposition[27])){
324                listOfNeighboors[1]=possibleposition[28]; //west
325                        listOfNeighboors[2]=possibleposition[37]; //north
326                        listOfNeighboors[3]=possibleposition[26]; //east
327                        return listOfNeighboors[s];
328            }
329            else if(findpos(pacLasVisPos,possibleposition[28])){
330                listOfNeighboors[1]=possibleposition[29]; //west
331                        listOfNeighboors[2]=possibleposition[36]; //north
332                        listOfNeighboors[3]=possibleposition[27]; //east
333                        return listOfNeighboors[s];
334            }
335            else if(findpos(pacLasVisPos,possibleposition[29])){
336                listOfNeighboors[0]=possibleposition[24]; //south
337                listOfNeighboors[1]=possibleposition[30]; //west
338                        listOfNeighboors[3]=possibleposition[28]; //east
339                        return listOfNeighboors[s];
340            }
341            else if(findpos(pacLasVisPos,possibleposition[30])){
342                listOfNeighboors[0]=possibleposition[23]; //south
343                        listOfNeighboors[2]=possibleposition[34]; //north
344                        listOfNeighboors[3]=possibleposition[29]; //east
345                        return listOfNeighboors[s];
346            }
347            else if(findpos(pacLasVisPos,possibleposition[31])){
348                listOfNeighboors[0]=possibleposition[22]; //south
349                listOfNeighboors[1]=possibleposition[32]; //west
350                        return listOfNeighboors[s];
351            }
352            else if(findpos(pacLasVisPos,possibleposition[32])){
353                        listOfNeighboors[2]=possibleposition[33]; //north
354                        listOfNeighboors[3]=possibleposition[31]; //east
355                        return listOfNeighboors[s];
356            }
357            else if(findpos(pacLasVisPos,possibleposition[33])){
358                listOfNeighboors[0]=possibleposition[32]; //south
359                        listOfNeighboors[3]=possibleposition[34]; //east
360                        return listOfNeighboors[s];
361            }
362            else if(findpos(pacLasVisPos,possibleposition[34])){
363                listOfNeighboors[0]=possibleposition[30]; //south
364                listOfNeighboors[1]=possibleposition[33]; //west
365                        listOfNeighboors[2]=possibleposition[92]; //north
366                        listOfNeighboors[3]=possibleposition[35]; //east
367                        return listOfNeighboors[s];
368            }
369            else if(findpos(pacLasVisPos,possibleposition[35])){
370                listOfNeighboors[1]=possibleposition[34]; //west
371                        listOfNeighboors[2]=possibleposition[91]; //north
372                        listOfNeighboors[3]=possibleposition[36]; //east
373                        return listOfNeighboors[s];
374            }
375            else if(findpos(pacLasVisPos,possibleposition[36])){
376                listOfNeighboors[0]=possibleposition[28]; //south
377                listOfNeighboors[1]=possibleposition[35]; //west
378                        return listOfNeighboors[s];
379            }
380            else if(findpos(pacLasVisPos,possibleposition[37])){
381                listOfNeighboors[0]=possibleposition[27]; //south
382                        listOfNeighboors[3]=possibleposition[38]; //east
383                        return listOfNeighboors[s];
384            }
385            else if(findpos(pacLasVisPos,possibleposition[38])){
386                listOfNeighboors[1]=possibleposition[37]; //west
387                        listOfNeighboors[2]=possibleposition[39]; //north
388                        listOfNeighboors[3]=possibleposition[9]; //east
389                        return listOfNeighboors[s];
390            }
391            else if(findpos(pacLasVisPos,possibleposition[39])){
392                listOfNeighboors[0]=possibleposition[38]; //south
393                listOfNeighboors[1]=possibleposition[40]; //west
394                        listOfNeighboors[2]=possibleposition[45]; //north
395                        return listOfNeighboors[s];
396            }
397            else if(findpos(pacLasVisPos,possibleposition[40])){
398                listOfNeighboors[1]=possibleposition[41]; //west
399                        //Not return in center
400                        listOfNeighboors[3]=possibleposition[39]; //east
401                        return listOfNeighboors[s];
402            }
403            else if(findpos(pacLasVisPos,possibleposition[41])){
404                listOfNeighboors[0]=possibleposition[35]; //south
405                        listOfNeighboors[2]=possibleposition[43]; //north
406                        listOfNeighboors[3]=possibleposition[40]; //east
407                        return listOfNeighboors[s];
408            }
409            else if(findpos(pacLasVisPos,possibleposition[42])){
410                listOfNeighboors[0]=possibleposition[39]; //south
411                        listOfNeighboors[2]=possibleposition[59]; //north
412                        listOfNeighboors[3]=possibleposition[43]; //east
413                        return listOfNeighboors[s];
414            }
415            else if(findpos(pacLasVisPos,possibleposition[43])){
416                listOfNeighboors[0]=possibleposition[41]; //south
417                listOfNeighboors[1]=possibleposition[42]; //west
418                        listOfNeighboors[2]=possibleposition[46]; //north
419                        return listOfNeighboors[s];
420            }
421            else if(findpos(pacLasVisPos,possibleposition[44])){
422                listOfNeighboors[0]=possibleposition[40]; //south
423                        listOfNeighboors[2]=possibleposition[66]; //north
424                        return listOfNeighboors[s];
425            }
426            else if(findpos(pacLasVisPos,possibleposition[45])){
427                listOfNeighboors[0]=possibleposition[39]; //south
428                        listOfNeighboors[2]=possibleposition[49]; //north
429                        listOfNeighboors[3]=possibleposition[10]; //east
430                        return listOfNeighboors[s];
431            }
432            else if(findpos(pacLasVisPos,possibleposition[46])){
433                listOfNeighboors[0]=possibleposition[43]; //south
434                        listOfNeighboors[3]=possibleposition[47]; //east
435                        return listOfNeighboors[s];
436            }
437            else if(findpos(pacLasVisPos,possibleposition[47])){
438                listOfNeighboors[1]=possibleposition[46]; //west
439                        listOfNeighboors[2]=possibleposition[52]; //north
440                        listOfNeighboors[3]=possibleposition[66]; //east
441                        return listOfNeighboors[s];
442            }
443            else if(findpos(pacLasVisPos,possibleposition[48])){
444                listOfNeighboors[1]=possibleposition[66]; //west
445                        listOfNeighboors[2]=possibleposition[51]; //north
446                        listOfNeighboors[3]=possibleposition[49]; //east
447                        return listOfNeighboors[s];
448            }
449            else if(findpos(pacLasVisPos,possibleposition[49])){
450                listOfNeighboors[0]=possibleposition[45]; //south
451                listOfNeighboors[1]=possibleposition[48]; //west
452                        return listOfNeighboors[s];
453            }
454            else if(findpos(pacLasVisPos,possibleposition[50])){
455                listOfNeighboors[1]=possibleposition[51]; //west
456                        listOfNeighboors[2]=possibleposition[61]; //north
457                        return listOfNeighboors[s];
458            }
459            else if(findpos(pacLasVisPos,possibleposition[51])){
460                listOfNeighboors[0]=possibleposition[48]; //south
461                        listOfNeighboors[3]=possibleposition[50]; //east
462                        return listOfNeighboors[s];
463            }
464            else if(findpos(pacLasVisPos,possibleposition[52])){
465                listOfNeighboors[0]=possibleposition[47]; //south
466                listOfNeighboors[1]=possibleposition[53]; //west
467                        return listOfNeighboors[s];
468            }
469            else if(findpos(pacLasVisPos,possibleposition[53])){
470                        listOfNeighboors[2]=possibleposition[58]; //north
471                        listOfNeighboors[3]=possibleposition[52]; //east
472                        return listOfNeighboors[s];
473            }
474            else if(findpos(pacLasVisPos,possibleposition[54])){
475                listOfNeighboors[0]=possibleposition[42]; //south
476                listOfNeighboors[1]=possibleposition[55]; //west
477                        listOfNeighboors[2]=possibleposition[57]; //north
478                        return listOfNeighboors[s];
479            }
480            else if(findpos(pacLasVisPos,possibleposition[55])){
481                        listOfNeighboors[2]=possibleposition[56]; //north
482                        listOfNeighboors[3]=possibleposition[54]; //east
483                        return listOfNeighboors[s];
484            }
485            else if(findpos(pacLasVisPos,possibleposition[56])){
486                listOfNeighboors[0]=possibleposition[55]; //south
487                        listOfNeighboors[2]=possibleposition[65]; //north
488                        listOfNeighboors[3]=possibleposition[57]; //east
489                        return listOfNeighboors[s];
490            }
491            else if(findpos(pacLasVisPos,possibleposition[57])){
492                listOfNeighboors[0]=possibleposition[54]; //south
493                listOfNeighboors[1]=possibleposition[56]; //west
494                        listOfNeighboors[2]=possibleposition[64]; //north
495                        listOfNeighboors[3]=possibleposition[58]; //east
496                        return listOfNeighboors[s];
497            }
498            else if(findpos(pacLasVisPos,possibleposition[58])){
499                listOfNeighboors[0]=possibleposition[53]; //south
500                listOfNeighboors[1]=possibleposition[57]; //west
501                        listOfNeighboors[3]=possibleposition[59]; //east
502                        return listOfNeighboors[s];
503            }
504            else if(findpos(pacLasVisPos,possibleposition[59])){
505                listOfNeighboors[1]=possibleposition[58]; //west
506                        listOfNeighboors[2]=possibleposition[63]; //north
507                        listOfNeighboors[3]=possibleposition[60]; //east
508                        return listOfNeighboors[s];
509            }
510            else if(findpos(pacLasVisPos,possibleposition[60])){
511                listOfNeighboors[1]=possibleposition[59]; //west
512                        listOfNeighboors[2]=possibleposition[62]; //north
513                        listOfNeighboors[3]=possibleposition[61]; //east
514                        return listOfNeighboors[s];
515            }
516            else if(findpos(pacLasVisPos,possibleposition[61])){
517                listOfNeighboors[0]=possibleposition[50]; //south
518                listOfNeighboors[1]=possibleposition[60]; //west
519                        listOfNeighboors[3]=possibleposition[13]; //east
520                        return listOfNeighboors[s];
521            }
522            else if(findpos(pacLasVisPos,possibleposition[62])){
523                listOfNeighboors[0]=possibleposition[60]; //south
524                        listOfNeighboors[3]=possibleposition[16]; //east
525                        return listOfNeighboors[s];
526            }
527            else if(findpos(pacLasVisPos,possibleposition[63])){
528                listOfNeighboors[0]=possibleposition[59]; //south
529                listOfNeighboors[1]=possibleposition[64]; //west
530                        return listOfNeighboors[s];
531            }
532            else if(findpos(pacLasVisPos,possibleposition[64])){
533                listOfNeighboors[0]=possibleposition[57]; //south
534                listOfNeighboors[1]=possibleposition[65]; //west
535                        listOfNeighboors[3]=possibleposition[63]; //east
536                        return listOfNeighboors[s];
537            }
538            else if(findpos(pacLasVisPos,possibleposition[65])){
539                listOfNeighboors[0]=possibleposition[56]; //south
540                        listOfNeighboors[3]=possibleposition[64]; //east
541                        return listOfNeighboors[s];
542            }
543            else if(findpos(pacLasVisPos,possibleposition[66])){
544                //Not back in center
545                listOfNeighboors[1]=possibleposition[47]; //west
546                        listOfNeighboors[3]=possibleposition[48]; //east
547                        return listOfNeighboors[s];           
548                }
549
550
551        }
552
553       
554
555       
Note: See TracBrowser for help on using the repository browser.