bool getPosition(char ch,pNode p) {
for (int i=0;i for (int j=0;j if (map[i][j]==ch) { p->x=i; p->y=j; return true; } } } return false; } float escape(char *revs,int len_revs,int time,Andy andy) { int i,j; int tempTime; float max=-1; float temp; Node path[MAX_MAP_SIZE*MAX_MAP_SIZE]; int len_path=1; Andy newAndy; bool flag; for (i=0;i<4+M;i++) { flag=false; for (j=1;j if (revs[j]==keywords[i]) { flag=true; break; } } if (flag) { continue; } getPosition(revs[len_revs-1],path); tempTime=shortestPath(path,len_path,keywords[i],revs,len_revs,time); if (tempTime>0) { if (keywords[i]=='E') //ÕÒµ½³ö¿Ú { temp=(float)andy.p/(Time-time+tempTime); /*cout< cout< cout< { if (keywords[i]=='A') { newAndy.p=andy.p+P; newAndy.q=andy.q; newAndy.r=andy.r; } else if (keywords[i]=='B') { newAndy.p=andy.p; newAndy.q=andy.q+Q; newAndy.r=andy.r; } else if (keywords[i]=='C') { newAndy.p=andy.p; newAndy.q=andy.q; newAndy.r=andy.r+R; } else //ÔâÓö¹ÖÊÞ { pMonster pMon=mons+keywords[i]-'0'; if (andy.q newAndy.p=-1; //¸ù± ¾¹ý²»È¥£¬¹ÖÊ޵ķÀÓùÌ«¸ß } else if (pMon->q ºÜ¸ß£¬¶ø²»»áËðʧÄÜÁ¿ { newAndy.p=andy.p; } else { newAndy.p=andy.p-(pMon->q-andy.r)*(pMon->p/(andy.q-pMon->r)); } newAndy.q=andy.q; newAndy.r=andy.r; } revs[len_revs]=keywords[i]; temp=escape(revs,len_revs+1,time-tempTime,newAndy); } max=max>temp? max:temp; } } return max; }