bool visit[maxn];///访问标记
const int dr[]= {-,,,,-,,-,}; ///向左上右下,左下,右上,右下,左上
const int dc[]= {,,,-,-,,,-};
struct node
{
int r;
int c;
int step;
};
node input[maxn];
void bfs(node start)
{
queue <node> q; /// BFS 队列
node now,next; /// 定义2 个状态,当前和下一个
start.Step_Counter=; /// 计数器清零
q.push(start); /// 入队
visit[start.x][start.y]=; /// 访问标记
while(!q.empty())
{
now=q.front();
q.pop();
if(符合输出条件)
{
输出操作;
return;
}
for(int i=; i<; i++)
{
next.r=now.r+dr[i],next.c=now.c+dc[i];
next.step=now.step+;
if(符合前进条件)
{
visit[next.r][next.c]=;
q.push(next);
}
}
}
return;
}