数据结构 c语言
do{
if(pass(curpos,a)){//当前位置可通
footprint(a,curpos);//留下足迹;
e->ord=curstep;
e->seat=curpos;
e->di=1;
push(s,e);
if(curpos->seatx==end->seatx&&curpos->seaty==end->seaty)break;//到达终点(出口)
nextpos(curpos,e->seat,1);//切换当前位置的右边作为新的当前位置;
curstep++; //探索下一步
}
else{//当前位置不通
if(e->di<4){pop(s,e);e->di++,push(s,e);nextpos(curpos,e->seat,e->di);}
else if(e->di==4){
pop(s,e);push(s,e);e->di++;
if(e->di>4)pop(s,e);
nextpos(curpos,e->seat,e->di);
}
}
}while(1);
puts("输出路径为:");
print(s);
printf("\n");
}