1. 程式人生 > 其它 >1.the map formwork(bfs)

1.the map formwork(bfs)

1.the map formwork(bfs)

struct node{
int x,y,st;
};
bool check()
{  out of boarder
   the end
   the special conditions
}
bfs()
{  node cur,next;
   queue<node>q;
   cur.x=
   cur.y=
   cur.st=
   q.push(cur);
   while(!q.empty())
   { 
       cur=q.front();
       q.pop();
       next.x=cur.x.
.. next.y=cur.y... if(check()) { next.st=cur.st... vis[]=1; .... q.push(next); } add if wrong what will happen }